diff --git a/default.nix b/default.nix index c6e9684..3b3d531 100644 --- a/default.nix +++ b/default.nix @@ -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 + ]; }; ############ diff --git a/nix/lib/mk-haskell-app.nix b/nix/lib/mk-haskell-app.nix index caf46c1..5f94492 100644 --- a/nix/lib/mk-haskell-app.nix +++ b/nix/lib/mk-haskell-app.nix @@ -10,6 +10,7 @@ let ## We need these inputs at buildtime: extraNativeBuildInputs = [ pkgs.git + pkgs.installShellFiles pkgs.makeWrapper pkgs.ronn ] ++ nativeBuildInputs; @@ -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 (