Skip to content

Commit

Permalink
bash-language-server: use pnpm.fetchDeps instead of node2nix
Browse files Browse the repository at this point in the history
  • Loading branch information
doronbehar committed Jun 13, 2024
1 parent 21d22ef commit 43f62ef
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 1 deletion.
73 changes: 73 additions & 0 deletions pkgs/by-name/ba/bash-language-server/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{ lib
, stdenv
, fetchFromGitHub
, pnpm_8
, nodejs
, npmHooks
, makeBinaryWrapper
}:

stdenv.mkDerivation (finalAttrs: {
pname = "bash-language-server";
version = "5.4.0";

src = fetchFromGitHub {
owner = "bash-lsp";
repo = "bash-language-server";
rev = "server-${finalAttrs.version}";
hash = "sha256-yJ81oGd9aNsWQMLvDSgMVVH1//Mw/SVFYFIPsJTQYzE=";
};

pnpmDeps = pnpm_8.fetchDeps {
inherit (finalAttrs) pname version src;
hash = "sha256-W25xehcxncBs9QgQBt17F5YHK0b+GDEmt27XzTkyYWg=";
};

nativeBuildInputs = [
nodejs
pnpm_8.configHook
npmHooks.npmBuildHook
makeBinaryWrapper
];
npmBuildScript = "compile";
# We are only interested in the bash-language-server executable, which is
# part of the `./server` directory. From some reason, the `./vscode-client`
# directory is not included in upstream's `pnpm-workspace.yaml`, so perhaps
# that's why our ${pnpmDeps} don't include the dependencies required for it.
preBuild = ''
rm -r vscode-client
substituteInPlace tsconfig.json \
--replace-fail '{ "path": "./vscode-client" },' ""
'';

installPhase = ''
runHook preInstall
pnpm --offline \
--frozen-lockfile --ignore-script \
--filter=bash-language-server \
deploy $out/lib/bash-language-server
# Cleanup directory a bit, to save space, and make fixup phase a bit faster
rm -r $out/lib/bash-language-server/src
find $out/lib/bash-language-server -name '*.ts' -delete
rm -r \
$out/lib/bash-language-server/node_modules/.bin \
$out/lib/bash-language-server/node_modules/*/bin
# Create the executable, based upon what happens in npmHooks.npmInstallHook
makeWrapper ${lib.getExe nodejs} $out/bin/bash-language-server \
--inherit-argv0 \
--add-flags $out/lib/bash-language-server/out/cli.js
runHook postInstall
'';

meta = with lib; {
description = "A language server for Bash";
homepage = "https://github.com/bash-lsp/bash-language-server";
license = licenses.mit;
maintainers = with maintainers; [ doronbehar ];
mainProgram = "bash-language-server";
platforms = platforms.all;
};
})
1 change: 1 addition & 0 deletions pkgs/development/node-packages/aliases.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ mapAliases {
inherit (pkgs) asar; # added 2023-08-26
inherit (pkgs) aws-azure-login; # added 2023-09-30
balanceofsatoshis = pkgs.balanceofsatoshis; # added 2023-07-31
inherit (pkgs) bash-language-server; # added 2024-06-07
bibtex-tidy = pkgs.bibtex-tidy; # added 2023-07-30
bitwarden-cli = pkgs.bitwarden-cli; # added 2023-07-25
inherit (pkgs) btc-rpc-explorer; # added 2023-08-17
Expand Down
1 change: 0 additions & 1 deletion pkgs/development/node-packages/node-packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
, "auto-changelog"
, "aws-cdk"
, "awesome-lint"
, "bash-language-server"
, "bower"
, "bower2nix"
, "browserify"
Expand Down

0 comments on commit 43f62ef

Please sign in to comment.