Skip to content

Commit

Permalink
Merge pull request #6 from vst/4-shell-completions-for-nix-based-inst…
Browse files Browse the repository at this point in the history
…allations

Install Shell Completions
  • Loading branch information
vst authored Mar 19, 2024
2 parents 826c30c + 2d6afc9 commit ebeeeb3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ let
## Get the installable application (only static executable):
thisApp = mkHaskellApp {
drv = thisHaskell.${thisHaskellPackages.main.name};
binPaths = [ ];
binPaths = [
pkgs.bashInteractive ## Added for bash-based CLI option completions
];
};

############
Expand Down
6 changes: 6 additions & 0 deletions nix/lib/mk-haskell-app.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ let
## We need these inputs at buildtime:
extraNativeBuildInputs = [
pkgs.git
pkgs.installShellFiles
pkgs.makeWrapper
pkgs.ronn
] ++ nativeBuildInputs;
Expand All @@ -21,6 +22,11 @@ let
extraPostFixup = ''
## Wrap program:
wrapProgram $out/bin/${name} --prefix PATH : ${binPath}
## Install completion scripts:
installShellCompletion --bash --name ${name}.bash <($out/bin/${name} --bash-completion-script "$out/bin/${name}")
installShellCompletion --fish --name ${name}.fish <($out/bin/${name} --fish-completion-script "$out/bin/${name}")
installShellCompletion --zsh --name _${name} <($out/bin/${name} --zsh-completion-script "$out/bin/${name}")
'';
in
pkgs.haskell.lib.justStaticExecutables (
Expand Down

0 comments on commit ebeeeb3

Please sign in to comment.