Open
Description
It would be nice to have an easy way of installing bash completions from optparse-applicative.
We've added a small post install script to our own CLI tools with a module like the following:
{pkgs, ...}:
{
packages.our-pkg-one.components.exes.our-exe-one.build-tools = [ pkgs.installShellFiles ];
packages.our-pkg-one.components.all.postInstall = pkgs.lib.mkForce "";
packages.our-pkg-one.components.exes.our-exe-one.postInstall = ''
$out/bin/our-exe-one --bash-completion-script $out/bin/our-exe-one > our-exe-one.bash
installShellCompletion --name our-exe-one --bash our-exe-one.bash
'';
packages.our-pkg-two.components.exes.our-exe-two.build-tools = [ pkgs.installShellFiles ];
packages.our-pkg-two.components.all.postInstall = pkgs.lib.mkForce "";
packages.our-pkg-two.components.exes.our-exe-two.postInstall = ''
$out/bin/our-exe-two --bash-completion-script $out/bin/our-exe-two > our-exe-two.bash
installShellCompletion --name our-exe-two --bash our-exe-two.bash
'';
However, this is somewhat repetitive. It would be ideal if haskell.nix provided some sort of functionality for easily enabling this for a given package/exe.
The haskell stuff in nixpkgs has a function for doing this: