diff --git a/pkgs/by-name/ba/bacon/package.nix b/pkgs/by-name/ba/bacon/package.nix index 337f7e8a6aaa..5eee447e708f 100644 --- a/pkgs/by-name/ba/bacon/package.nix +++ b/pkgs/by-name/ba/bacon/package.nix @@ -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; };