bacon: install shell completions

This commit is contained in:
Bryce Berger
2025-03-05 00:18:54 -05:00
parent d325772e9e
commit eb833bebe3
+20 -3
View File
@@ -3,10 +3,12 @@
stdenv,
rustPlatform,
fetchFromGitHub,
installShellFiles,
pkg-config,
alsa-lib,
versionCheckHook,
bacon,
buildPackages,
nix-update-script,
withSound ? false,
@@ -41,9 +43,13 @@ rustPlatform.buildRustPackage (finalAttrs: {
"sound"
];
nativeBuildInputs = lib.optionals withSound [
pkg-config
];
nativeBuildInputs =
[
installShellFiles
]
++ lib.optionals withSound [
pkg-config
];
buildInputs = lib.optionals withSound soundDependencies;
@@ -51,6 +57,17 @@ rustPlatform.buildRustPackage (finalAttrs: {
versionCheckProgramArg = [ "--version" ];
doInstallCheck = true;
postInstall =
let
bacon = "${stdenv.hostPlatform.emulator buildPackages} $out/bin/bacon";
in
lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) ''
installShellCompletion --cmd bacon \
--bash <(COMPLETE=bash ${bacon}) \
--fish <(COMPLETE=fish ${bacon}) \
--zsh <(COMPLETE=zsh ${bacon})
'';
passthru = {
tests = {
withSound = bacon.override { withSound = true; };