moon: add shell completions

This commit is contained in:
awwpotato
2025-04-23 07:23:24 -07:00
parent 88dd31be02
commit 0790ac9ce7
+19 -1
View File
@@ -1,11 +1,14 @@
{
lib,
stdenv,
rustPlatform,
fetchFromGitHub,
openssl,
pkg-config,
versionCheckHook,
nix-update-script,
installShellFiles,
buildPackages,
}:
rustPlatform.buildRustPackage (finalAttrs: {
@@ -27,7 +30,22 @@ rustPlatform.buildRustPackage (finalAttrs: {
};
buildInputs = [ openssl ];
nativeBuildInputs = [ pkg-config ];
nativeBuildInputs = [
pkg-config
installShellFiles
];
postInstall = lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) (
let
emulator = stdenv.hostPlatform.emulator buildPackages;
in
''
installShellCompletion --cmd moon \
--bash <(${emulator} $out/bin/moon completions --shell bash) \
--fish <(${emulator} $out/bin/moon completions --shell fish) \
--zsh <(${emulator} $out/bin/moon completions --shell zsh)
''
);
# Some tests fail, because test using internet connection and install NodeJS by example
doCheck = false;