Skip to content

Commit

Permalink
nodejs: add bash shell completion
Browse files Browse the repository at this point in the history
  • Loading branch information
superherointj committed Jun 2, 2024
1 parent d51dc4a commit f8d01a8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkgs/development/web/nodejs/nodejs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
, gnupg
, darwin, xcbuild
, procps, icu
, installShellFiles
}:

{ enableNpm ? true, version, sha256, patches ? [] } @args:
Expand Down Expand Up @@ -69,7 +70,7 @@ let
buildInputs = lib.optionals stdenv.isDarwin [ CoreServices ApplicationServices ]
++ [ zlib libuv openssl http-parser icu bash ];

nativeBuildInputs = [ which pkg-config python ]
nativeBuildInputs = [ installShellFiles pkg-config python which ]
++ lib.optionals stdenv.isDarwin [ xcbuild ];

outputs = [ "out" "libv8" ];
Expand Down Expand Up @@ -151,6 +152,11 @@ let
postInstall = ''
HOST_PATH=$out/bin patchShebangs --host $out
${lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
$out/bin/${self.meta.mainProgram} --completion-bash > ${self.meta.mainProgram}.bash
installShellCompletion ${self.meta.mainProgram}.bash
''}
${lib.optionalString (enableNpm) ''
mkdir -p $out/share/bash-completion/completions
ln -s $out/lib/node_modules/npm/lib/utils/completion.sh \
Expand Down

0 comments on commit f8d01a8

Please sign in to comment.