packages/ruler: add completions

This commit is contained in:
Primrose 2025-10-06 22:03:32 +08:00
parent df559db2fb
commit e5d144ad4f
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA

View file

@ -2,8 +2,9 @@
haskellPackages, haskellPackages,
haskell, haskell,
fetchFromGitea, fetchFromGitea,
installShellFiles,
}: let }: let
inherit (haskell.lib.compose) justStaticExecutables; inherit (haskell.lib.compose) justStaticExecutables overrideCabal;
drv = drv =
haskellPackages.callCabal2nix "ruler" haskellPackages.callCabal2nix "ruler"
@ -15,5 +16,18 @@
hash = "sha256-gWW5rcL3NI0BExEVqXL+avk7z1/4WYEwEwjtZjqSXNM="; hash = "sha256-gWW5rcL3NI0BExEVqXL+avk7z1/4WYEwEwjtZjqSXNM=";
}) })
{}; {};
cabalOverrides = o: {
buildTools = o.buildTools or [] ++ [installShellFiles];
postInstall =
o.postInstall or ""
+ ''
installShellCompletion --cmd ruler \
--bash <("$out/bin/ruler" --bash-completion-script "$out/bin/ruler") \
--fish <("$out/bin/ruler" --fish-completion-script "$out/bin/ruler") \
--zsh <("$out/bin/ruler" --zsh-completion-script "$out/bin/ruler")
'';
};
in in
justStaticExecutables drv justStaticExecutables
(overrideCabal cabalOverrides drv)