diff --git a/pkgs/applications/misc/comodoro/default.nix b/pkgs/applications/misc/comodoro/default.nix index b9fd5ea28ba9a..01836f5830666 100644 --- a/pkgs/applications/misc/comodoro/default.nix +++ b/pkgs/applications/misc/comodoro/default.nix @@ -3,8 +3,8 @@ , fetchFromGitHub , stdenv , installShellFiles -, installShellCompletions ? stdenv.hostPlatform == stdenv.buildPlatform -, installManPages ? stdenv.hostPlatform == stdenv.buildPlatform +, installShellCompletions ? stdenv.buildPlatform.canExecute stdenv.hostPlatform +, installManPages ? stdenv.buildPlatform.canExecute stdenv.hostPlatform , withTcp ? true }: diff --git a/pkgs/applications/misc/flavours/default.nix b/pkgs/applications/misc/flavours/default.nix index ffb329129d8e8..98146e6bfdf38 100644 --- a/pkgs/applications/misc/flavours/default.nix +++ b/pkgs/applications/misc/flavours/default.nix @@ -17,7 +17,7 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ installShellFiles ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd flavours \ --zsh <($out/bin/flavours --completions zsh) \ --fish <($out/bin/flavours --completions fish) \ diff --git a/pkgs/applications/misc/genact/default.nix b/pkgs/applications/misc/genact/default.nix index 8591b749a4068..d2abfc02ba770 100644 --- a/pkgs/applications/misc/genact/default.nix +++ b/pkgs/applications/misc/genact/default.nix @@ -1,4 +1,4 @@ -{ lib, rustPlatform, fetchFromGitHub, installShellFiles }: +{ lib, rustPlatform, fetchFromGitHub, installShellFiles, stdenv }: rustPlatform.buildRustPackage rec { pname = "genact"; @@ -15,7 +15,7 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ installShellFiles ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' $out/bin/genact --print-manpage > genact.1 installManPage genact.1 diff --git a/pkgs/applications/misc/inlyne/default.nix b/pkgs/applications/misc/inlyne/default.nix index a37f965dd5306..f896b45187906 100644 --- a/pkgs/applications/misc/inlyne/default.nix +++ b/pkgs/applications/misc/inlyne/default.nix @@ -51,11 +51,11 @@ rustPlatform.buildRustPackage rec { "--skip=watcher::tests::the_gauntlet" ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd inlyne \ - --bash <($out/bin/inlyne --gen-completions bash) \ - --fish <($out/bin/inlyne --gen-completions fish) \ - --zsh <($out/bin/inlyne --gen-completions zsh) + --bash completions/inlyne.bash \ + --fish completions/inlyne.fish \ + --zsh completions/_inlyne ''; postFixup = lib.optionalString stdenv.isLinux '' diff --git a/pkgs/applications/misc/leetcode-cli/default.nix b/pkgs/applications/misc/leetcode-cli/default.nix index f2e217404eb4b..9bc7c7cbe34a1 100644 --- a/pkgs/applications/misc/leetcode-cli/default.nix +++ b/pkgs/applications/misc/leetcode-cli/default.nix @@ -34,7 +34,7 @@ rustPlatform.buildRustPackage rec { sqlite ] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd leetcode \ --bash <($out/bin/leetcode completions bash) \ --fish <($out/bin/leetcode completions fish) \ diff --git a/pkgs/applications/version-management/git-absorb/default.nix b/pkgs/applications/version-management/git-absorb/default.nix index aecc19f0aa160..49d4a0a67ad25 100644 --- a/pkgs/applications/version-management/git-absorb/default.nix +++ b/pkgs/applications/version-management/git-absorb/default.nix @@ -19,6 +19,7 @@ rustPlatform.buildRustPackage rec { postInstall = '' installManPage Documentation/git-absorb.1 + '' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd git-absorb \ --bash <($out/bin/git-absorb --gen-completions bash) \ --fish <($out/bin/git-absorb --gen-completions fish) \ diff --git a/pkgs/applications/version-management/jujutsu/default.nix b/pkgs/applications/version-management/jujutsu/default.nix index 98d1a8f8e1443..35a71c30444fa 100644 --- a/pkgs/applications/version-management/jujutsu/default.nix +++ b/pkgs/applications/version-management/jujutsu/default.nix @@ -52,7 +52,7 @@ rustPlatform.buildRustPackage rec { libiconv ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' $out/bin/jj util mangen > ./jj.1 installManPage ./jj.1 diff --git a/pkgs/applications/virtualization/youki/default.nix b/pkgs/applications/virtualization/youki/default.nix index 506179dbf35c6..7b7cf4911c90c 100644 --- a/pkgs/applications/virtualization/youki/default.nix +++ b/pkgs/applications/virtualization/youki/default.nix @@ -6,6 +6,7 @@ , dbus , libseccomp , systemd +, stdenv }: rustPlatform.buildRustPackage rec { @@ -27,7 +28,7 @@ rustPlatform.buildRustPackage rec { buildInputs = [ dbus libseccomp systemd ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd youki \ --bash <($out/bin/youki completion -s bash) \ --fish <($out/bin/youki completion -s fish) \ diff --git a/pkgs/by-name/ab/ab-av1/package.nix b/pkgs/by-name/ab/ab-av1/package.nix index 7319c2fa22a87..aa057f69e06bd 100644 --- a/pkgs/by-name/ab/ab-av1/package.nix +++ b/pkgs/by-name/ab/ab-av1/package.nix @@ -1,4 +1,4 @@ -{ lib, rustPlatform, fetchFromGitHub, installShellFiles }: +{ lib, rustPlatform, fetchFromGitHub, installShellFiles, stdenv }: rustPlatform.buildRustPackage rec { pname = "ab-av1"; @@ -15,7 +15,7 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ installShellFiles ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd ab-av1 \ --bash <($out/bin/ab-av1 print-completions bash) \ --fish <($out/bin/ab-av1 print-completions fish) \ diff --git a/pkgs/by-name/as/ast-grep/package.nix b/pkgs/by-name/as/ast-grep/package.nix index 644ef2e284ca0..ab33df30035a3 100644 --- a/pkgs/by-name/as/ast-grep/package.nix +++ b/pkgs/by-name/as/ast-grep/package.nix @@ -25,7 +25,7 @@ rustPlatform.buildRustPackage rec { rm .cargo/config.toml ''; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd sg \ --bash <($out/bin/sg completions bash) \ --fish <($out/bin/sg completions fish) \ diff --git a/pkgs/by-name/at/attic-client/package.nix b/pkgs/by-name/at/attic-client/package.nix index e369f4e8dd6aa..6fca674f435ae 100644 --- a/pkgs/by-name/at/attic-client/package.nix +++ b/pkgs/by-name/at/attic-client/package.nix @@ -46,7 +46,7 @@ rustPlatform.buildRustPackage { # to nix-daemon to import NARs, which is not possible in the build sandbox. doCheck = false; - postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' if [[ -f $out/bin/attic ]]; then installShellCompletion --cmd attic \ --bash <($out/bin/attic gen-completions bash) \ diff --git a/pkgs/by-name/cl/clipcat/package.nix b/pkgs/by-name/cl/clipcat/package.nix index b72baf6e46b57..fe4803bd3eebe 100644 --- a/pkgs/by-name/cl/clipcat/package.nix +++ b/pkgs/by-name/cl/clipcat/package.nix @@ -38,7 +38,7 @@ rustPlatform.buildRustPackage rec { "--skip=test_x11_primary" ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' for cmd in clipcatd clipcatctl clipcat-menu clipcat-notify; do installShellCompletion --cmd $cmd \ --bash <($out/bin/$cmd completions bash) \ diff --git a/pkgs/by-name/co/codeberg-cli/package.nix b/pkgs/by-name/co/codeberg-cli/package.nix index fce36f682c3d6..825731d4d1b48 100644 --- a/pkgs/by-name/co/codeberg-cli/package.nix +++ b/pkgs/by-name/co/codeberg-cli/package.nix @@ -39,7 +39,7 @@ rustPlatform.buildRustPackage rec { ] ); - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd berg \ --bash <($out/bin/berg completion bash) \ --fish <($out/bin/berg completion fish) \ diff --git a/pkgs/by-name/di/diesel-cli/package.nix b/pkgs/by-name/di/diesel-cli/package.nix index ad626b57903a9..970d4458077ae 100644 --- a/pkgs/by-name/di/diesel-cli/package.nix +++ b/pkgs/by-name/di/diesel-cli/package.nix @@ -79,7 +79,7 @@ rustPlatform.buildRustPackage rec { # Tests currently fail due to *many* duplicate definition errors doCheck = false; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd diesel \ --bash <($out/bin/diesel completions bash) \ --fish <($out/bin/diesel completions fish) \ diff --git a/pkgs/by-name/el/elf2nucleus/package.nix b/pkgs/by-name/el/elf2nucleus/package.nix index fad1d87199712..1e755c6293389 100644 --- a/pkgs/by-name/el/elf2nucleus/package.nix +++ b/pkgs/by-name/el/elf2nucleus/package.nix @@ -4,6 +4,7 @@ , lib , micronucleus , rustPlatform +, stdenv }: rustPlatform.buildRustPackage rec { @@ -23,7 +24,7 @@ rustPlatform.buildRustPackage rec { buildInputs = [ micronucleus ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd elf2nucleus \ --bash <($out/bin/elf2nucleus --completions bash) \ --fish <($out/bin/elf2nucleus --completions fish) \ diff --git a/pkgs/by-name/en/engage/package.nix b/pkgs/by-name/en/engage/package.nix index 8a87e0d460971..585d072dae421 100644 --- a/pkgs/by-name/en/engage/package.nix +++ b/pkgs/by-name/en/engage/package.nix @@ -2,6 +2,7 @@ , installShellFiles , rustPlatform , fetchFromGitLab +, stdenv }: let @@ -25,7 +26,8 @@ rustPlatform.buildRustPackage { installShellFiles ]; - postInstall = "installShellCompletion --cmd ${pname} " + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ( + "installShellCompletion --cmd ${pname} " + builtins.concatStringsSep " " (builtins.map @@ -35,7 +37,8 @@ rustPlatform.buildRustPackage { "fish" "zsh" ] - ); + ) + ); meta = { description = "Task runner with DAG-based parallelism"; diff --git a/pkgs/by-name/hi/himalaya/package.nix b/pkgs/by-name/hi/himalaya/package.nix index 590791630669b..5a271432a0ccc 100644 --- a/pkgs/by-name/hi/himalaya/package.nix +++ b/pkgs/by-name/hi/himalaya/package.nix @@ -5,8 +5,8 @@ , pkg-config , darwin , installShellFiles -, installShellCompletions ? stdenv.hostPlatform == stdenv.buildPlatform -, installManPages ? stdenv.hostPlatform == stdenv.buildPlatform +, installShellCompletions ? stdenv.buildPlatform.canExecute stdenv.hostPlatform +, installManPages ? stdenv.buildPlatform.canExecute stdenv.hostPlatform , notmuch , gpgme , buildNoDefaultFeatures ? false diff --git a/pkgs/by-name/jo/joshuto/package.nix b/pkgs/by-name/jo/joshuto/package.nix index 08f5429fbb5ce..e24a3cd93e8f7 100644 --- a/pkgs/by-name/jo/joshuto/package.nix +++ b/pkgs/by-name/jo/joshuto/package.nix @@ -25,7 +25,7 @@ rustPlatform.buildRustPackage rec { darwin.apple_sdk.frameworks.Foundation ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd joshuto \ --bash <($out/bin/joshuto completions bash) \ --zsh <($out/bin/joshuto completions zsh) \ diff --git a/pkgs/by-name/ma/maa-cli/package.nix b/pkgs/by-name/ma/maa-cli/package.nix index e1bfed03e0eb7..075b028d12833 100644 --- a/pkgs/by-name/ma/maa-cli/package.nix +++ b/pkgs/by-name/ma/maa-cli/package.nix @@ -51,29 +51,32 @@ rustPlatform.buildRustPackage rec { # maa-cli would only seach libMaaCore.so and resources in itself's path # https://github.com/MaaAssistantArknights/maa-cli/issues/67 - postInstall = '' - mkdir -p $out/share/maa-assistant-arknights/ - ln -s ${maa-assistant-arknights}/share/maa-assistant-arknights/* $out/share/maa-assistant-arknights/ - ln -s ${maa-assistant-arknights}/lib/* $out/share/maa-assistant-arknights/ - mv $out/bin/maa $out/share/maa-assistant-arknights/ + postInstall = + '' + mkdir -p $out/share/maa-assistant-arknights/ + ln -s ${maa-assistant-arknights}/share/maa-assistant-arknights/* $out/share/maa-assistant-arknights/ + ln -s ${maa-assistant-arknights}/lib/* $out/share/maa-assistant-arknights/ + mv $out/bin/maa $out/share/maa-assistant-arknights/ - makeWrapper $out/share/maa-assistant-arknights/maa $out/bin/maa \ - --prefix PATH : "${ - lib.makeBinPath [ - android-tools - git - ] - }" + makeWrapper $out/share/maa-assistant-arknights/maa $out/bin/maa \ + --prefix PATH : "${ + lib.makeBinPath [ + android-tools + git + ] + }" - installShellCompletion --cmd maa \ - --bash <($out/bin/maa complete bash) \ - --fish <($out/bin/maa complete fish) \ - --zsh <($out/bin/maa complete zsh) + '' + + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + installShellCompletion --cmd maa \ + --bash <($out/bin/maa complete bash) \ + --fish <($out/bin/maa complete fish) \ + --zsh <($out/bin/maa complete zsh) - mkdir -p manpage - $out/bin/maa mangen --path manpage - installManPage manpage/* - ''; + mkdir -p manpage + $out/bin/maa mangen --path manpage + installManPage manpage/* + ''; meta = with lib; { description = "Simple CLI for MAA by Rust"; diff --git a/pkgs/by-name/ne/neverest/package.nix b/pkgs/by-name/ne/neverest/package.nix index ec095dab0286e..4b7076a8e03e7 100644 --- a/pkgs/by-name/ne/neverest/package.nix +++ b/pkgs/by-name/ne/neverest/package.nix @@ -5,8 +5,8 @@ , pkg-config , darwin , installShellFiles -, installShellCompletions ? stdenv.hostPlatform == stdenv.buildPlatform -, installManPages ? stdenv.hostPlatform == stdenv.buildPlatform +, installShellCompletions ? stdenv.buildPlatform.canExecute stdenv.hostPlatform +, installManPages ? stdenv.buildPlatform.canExecute stdenv.hostPlatform , notmuch , buildNoDefaultFeatures ? false , buildFeatures ? [] diff --git a/pkgs/by-name/pa/pace/package.nix b/pkgs/by-name/pa/pace/package.nix index 738077648c1bb..a90ce66f537e0 100644 --- a/pkgs/by-name/pa/pace/package.nix +++ b/pkgs/by-name/pa/pace/package.nix @@ -3,6 +3,7 @@ rustPlatform, fetchFromGitHub, installShellFiles, + stdenv, }: let version = "0.15.2"; in @@ -21,7 +22,7 @@ in nativeBuildInputs = [installShellFiles]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd pace \ --bash <($out/bin/pace setup completions bash) \ --fish <($out/bin/pace setup completions fish) \ diff --git a/pkgs/by-name/pi/pixi/package.nix b/pkgs/by-name/pi/pixi/package.nix index e6b4c55783929..8fe5169127e64 100644 --- a/pkgs/by-name/pi/pixi/package.nix +++ b/pkgs/by-name/pi/pixi/package.nix @@ -80,7 +80,7 @@ rustPlatform.buildRustPackage rec { "--skip=cli::shell_hook::tests::test_environment_json" ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd pixi \ --bash <($out/bin/pixi completion --shell bash) \ --fish <($out/bin/pixi completion --shell fish) \ diff --git a/pkgs/by-name/qr/qrtool/package.nix b/pkgs/by-name/qr/qrtool/package.nix index c761e4c178636..fe90881fd8d18 100644 --- a/pkgs/by-name/qr/qrtool/package.nix +++ b/pkgs/by-name/qr/qrtool/package.nix @@ -1,4 +1,5 @@ { lib +, stdenv , fetchFromGitHub , rustPlatform , asciidoctor @@ -24,6 +25,7 @@ rustPlatform.buildRustPackage rec { # Built by ./build.rs using `asciidoctor` installManPage ./target/*/release/build/qrtool*/out/*.? + '' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd qrtool \ --bash <($out/bin/qrtool --generate-completion bash) \ --fish <($out/bin/qrtool --generate-completion fish) \ diff --git a/pkgs/by-name/re/release-plz/package.nix b/pkgs/by-name/re/release-plz/package.nix index 25958a05d8c88..da5b97c8ef470 100644 --- a/pkgs/by-name/re/release-plz/package.nix +++ b/pkgs/by-name/re/release-plz/package.nix @@ -28,7 +28,7 @@ rustPlatform.buildRustPackage rec { # Tests depend on additional infrastructure to be running locally doCheck = false; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd ${meta.mainProgram} \ --bash <($out/bin/${meta.mainProgram} generate-completions bash) \ --fish <($out/bin/${meta.mainProgram} generate-completions fish) \ diff --git a/pkgs/by-name/sn/sn0int/package.nix b/pkgs/by-name/sn/sn0int/package.nix index 2410fa0cc230b..43eadd2c39402 100644 --- a/pkgs/by-name/sn/sn0int/package.nix +++ b/pkgs/by-name/sn/sn0int/package.nix @@ -41,7 +41,7 @@ rustPlatform.buildRustPackage rec { # in "checkPhase", hence fails in sandbox of "nix". doCheck = false; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd sn0int \ --bash <($out/bin/sn0int completions bash) \ --fish <($out/bin/sn0int completions fish) \ diff --git a/pkgs/by-name/so/solana-cli/package.nix b/pkgs/by-name/so/solana-cli/package.nix index b4a56dda78c96..aa7bcd58936d7 100644 --- a/pkgs/by-name/so/solana-cli/package.nix +++ b/pkgs/by-name/so/solana-cli/package.nix @@ -80,7 +80,7 @@ rustPlatform.buildRustPackage rec { Libsystem ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd solana \ --bash <($out/bin/solana completion --shell bash) \ --fish <($out/bin/solana completion --shell fish) \ diff --git a/pkgs/by-name/st/steamguard-cli/package.nix b/pkgs/by-name/st/steamguard-cli/package.nix index 38ed7f69b33b0..6cbdb77e10b94 100644 --- a/pkgs/by-name/st/steamguard-cli/package.nix +++ b/pkgs/by-name/st/steamguard-cli/package.nix @@ -2,6 +2,7 @@ , lib , rustPlatform , fetchFromGitHub +, stdenv }: rustPlatform.buildRustPackage rec { @@ -18,7 +19,7 @@ rustPlatform.buildRustPackage rec { cargoHash = "sha256-LYrn0MKrOYjYPLdBukXRXGW+XWVcGHNAl0vC/qkmkNs="; nativeBuildInputs = [ installShellFiles ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd steamguard \ --bash <($out/bin/steamguard completion --shell bash) \ --fish <($out/bin/steamguard completion --shell fish) \ diff --git a/pkgs/by-name/zo/zola/package.nix b/pkgs/by-name/zo/zola/package.nix index 2b25b1fd346b8..9f6152b3397c7 100644 --- a/pkgs/by-name/zo/zola/package.nix +++ b/pkgs/by-name/zo/zola/package.nix @@ -36,7 +36,7 @@ rustPlatform.buildRustPackage rec { RUSTONIG_SYSTEM_LIBONIG = true; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd zola \ --bash <($out/bin/zola completion bash) \ --fish <($out/bin/zola completion fish) \ diff --git a/pkgs/development/compilers/jrsonnet/default.nix b/pkgs/development/compilers/jrsonnet/default.nix index 3c4c5d71c0ce3..2031c006de6f9 100644 --- a/pkgs/development/compilers/jrsonnet/default.nix +++ b/pkgs/development/compilers/jrsonnet/default.nix @@ -1,4 +1,4 @@ -{ lib, rustPlatform, fetchFromGitHub, installShellFiles }: +{ lib, rustPlatform, fetchFromGitHub, installShellFiles, stdenv }: rustPlatform.buildRustPackage rec { pname = "jrsonnet"; @@ -28,6 +28,7 @@ rustPlatform.buildRustPackage rec { postInstall = '' ln -s $out/bin/jrsonnet $out/bin/jsonnet + '' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' for shell in bash zsh fish; do installShellCompletion --cmd jrsonnet \ --$shell <($out/bin/jrsonnet --generate $shell /dev/null) diff --git a/pkgs/development/tools/cocogitto/default.nix b/pkgs/development/tools/cocogitto/default.nix index 16bb018e36dd6..6760b4754203e 100644 --- a/pkgs/development/tools/cocogitto/default.nix +++ b/pkgs/development/tools/cocogitto/default.nix @@ -21,7 +21,7 @@ rustPlatform.buildRustPackage rec { buildInputs = [ libgit2 ] ++ lib.optional stdenv.isDarwin Security; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd cog \ --bash <($out/bin/cog generate-completions bash) \ --fish <($out/bin/cog generate-completions fish) \ diff --git a/pkgs/development/tools/espup/default.nix b/pkgs/development/tools/espup/default.nix index cbf5c447117db..ca650be0e386f 100644 --- a/pkgs/development/tools/espup/default.nix +++ b/pkgs/development/tools/espup/default.nix @@ -56,7 +56,7 @@ rustPlatform.buildRustPackage rec { "--skip=toolchain::rust::tests::test_xtensa_rust_parse_version" ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd espup \ --bash <($out/bin/espup completions bash) \ --fish <($out/bin/espup completions fish) \ diff --git a/pkgs/development/tools/fnm/default.nix b/pkgs/development/tools/fnm/default.nix index 7b521856a3e8b..9aafdb4e02c16 100644 --- a/pkgs/development/tools/fnm/default.nix +++ b/pkgs/development/tools/fnm/default.nix @@ -27,7 +27,7 @@ rustPlatform.buildRustPackage rec { doCheck = false; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd fnm \ --bash <($out/bin/fnm completions --shell bash) \ --fish <($out/bin/fnm completions --shell fish) \ diff --git a/pkgs/development/tools/rust/cargo-show-asm/default.nix b/pkgs/development/tools/rust/cargo-show-asm/default.nix index 02823914e15af..f6d52a2c54c61 100644 --- a/pkgs/development/tools/rust/cargo-show-asm/default.nix +++ b/pkgs/development/tools/rust/cargo-show-asm/default.nix @@ -22,7 +22,7 @@ rustPlatform.buildRustPackage rec { installShellFiles ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd cargo-asm \ --bash <($out/bin/cargo-asm --bpaf-complete-style-bash) \ --fish <($out/bin/cargo-asm --bpaf-complete-style-fish) \ diff --git a/pkgs/development/tools/rust/cauwugo/default.nix b/pkgs/development/tools/rust/cauwugo/default.nix index 10a3432d4dd4a..1f497a270b939 100644 --- a/pkgs/development/tools/rust/cauwugo/default.nix +++ b/pkgs/development/tools/rust/cauwugo/default.nix @@ -1,4 +1,4 @@ -{ lib, rustPlatform, fetchCrate, installShellFiles }: +{ lib, rustPlatform, fetchCrate, installShellFiles, stdenv }: rustPlatform.buildRustPackage rec { pname = "cauwugo"; @@ -14,7 +14,7 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ installShellFiles ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd cauwugo \ --bash <($out/bin/cauwugo --bpaf-complete-style-bash) \ --fish <($out/bin/cauwugo --bpaf-complete-style-fish) \ diff --git a/pkgs/development/tools/rust/typeshare/default.nix b/pkgs/development/tools/rust/typeshare/default.nix index 745784fc03047..1283df16fd002 100644 --- a/pkgs/development/tools/rust/typeshare/default.nix +++ b/pkgs/development/tools/rust/typeshare/default.nix @@ -2,6 +2,7 @@ , rustPlatform , fetchFromGitHub , installShellFiles +, stdenv }: rustPlatform.buildRustPackage rec { @@ -21,7 +22,7 @@ rustPlatform.buildRustPackage rec { buildFeatures = [ "go" ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd typeshare \ --bash <($out/bin/typeshare completions bash) \ --fish <($out/bin/typeshare completions fish) \ diff --git a/pkgs/development/tools/sentry-cli/default.nix b/pkgs/development/tools/sentry-cli/default.nix index cffe180a92d03..6a031160ffe77 100644 --- a/pkgs/development/tools/sentry-cli/default.nix +++ b/pkgs/development/tools/sentry-cli/default.nix @@ -29,7 +29,7 @@ rustPlatform.buildRustPackage rec { cargoHash = "sha256-9L02ox2T+dBRx+mmFpy5Bktsyp3C/havfZoDaNevIMw="; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd sentry-cli \ --bash <($out/bin/sentry-cli completions bash) \ --fish <($out/bin/sentry-cli completions fish) \ diff --git a/pkgs/development/tools/snazy/default.nix b/pkgs/development/tools/snazy/default.nix index e77cc4ae0c702..c279425384547 100644 --- a/pkgs/development/tools/snazy/default.nix +++ b/pkgs/development/tools/snazy/default.nix @@ -2,6 +2,7 @@ , rustPlatform , fetchFromGitHub , installShellFiles +, stdenv }: rustPlatform.buildRustPackage rec { @@ -19,7 +20,7 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ installShellFiles ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd snazy \ --bash <($out/bin/snazy --shell-completion bash) \ --fish <($out/bin/snazy --shell-completion fish) \ diff --git a/pkgs/development/tools/tokio-console/default.nix b/pkgs/development/tools/tokio-console/default.nix index 0618d818de3ed..03775abeeb51e 100644 --- a/pkgs/development/tools/tokio-console/default.nix +++ b/pkgs/development/tools/tokio-console/default.nix @@ -3,6 +3,7 @@ , installShellFiles , rustPlatform , protobuf +, stdenv }: rustPlatform.buildRustPackage rec { @@ -35,7 +36,7 @@ rustPlatform.buildRustPackage rec { "--skip config::tests::toml_example_changed" ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd tokio-console \ --bash <($out/bin/tokio-console --log-dir $(mktemp -d) gen-completion bash) \ --fish <($out/bin/tokio-console --log-dir $(mktemp -d) gen-completion fish) \ diff --git a/pkgs/development/tools/volta/default.nix b/pkgs/development/tools/volta/default.nix index e67df485b7f4e..15c9c493b797a 100644 --- a/pkgs/development/tools/volta/default.nix +++ b/pkgs/development/tools/volta/default.nix @@ -32,7 +32,7 @@ rustPlatform.buildRustPackage rec { HOME = "$TMPDIR"; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd volta \ --bash <($out/bin/volta completions bash) \ --fish <($out/bin/volta completions fish) \ diff --git a/pkgs/development/web/deno/default.nix b/pkgs/development/web/deno/default.nix index f4cd4f91e071f..3cf8d1d216963 100644 --- a/pkgs/development/web/deno/default.nix +++ b/pkgs/development/web/deno/default.nix @@ -68,7 +68,7 @@ rustPlatform.buildRustPackage rec { find ./target -name libswc_common${stdenv.hostPlatform.extensions.sharedLibrary} -delete ''; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd deno \ --bash <($out/bin/deno completions bash) \ --fish <($out/bin/deno completions fish) \ diff --git a/pkgs/servers/http/dufs/default.nix b/pkgs/servers/http/dufs/default.nix index e01c923e1cd2f..267f1ed38aaa6 100644 --- a/pkgs/servers/http/dufs/default.nix +++ b/pkgs/servers/http/dufs/default.nix @@ -33,7 +33,7 @@ rustPlatform.buildRustPackage rec { "--skip=validate_printed_urls" ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd dufs \ --bash <($out/bin/dufs --completions bash) \ --fish <($out/bin/dufs --completions fish) \ diff --git a/pkgs/tools/admin/colmena/default.nix b/pkgs/tools/admin/colmena/default.nix index 5c59a7b5386a3..0ef27f2ee560d 100644 --- a/pkgs/tools/admin/colmena/default.nix +++ b/pkgs/tools/admin/colmena/default.nix @@ -20,7 +20,7 @@ rustPlatform.buildRustPackage rec { NIX_EVAL_JOBS = "${nix-eval-jobs}/bin/nix-eval-jobs"; - postInstall = lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd colmena \ --bash <($out/bin/colmena gen-completions bash) \ --zsh <($out/bin/colmena gen-completions zsh) \ diff --git a/pkgs/tools/misc/charasay/default.nix b/pkgs/tools/misc/charasay/default.nix index 20594414daef5..5048b9dd655a1 100644 --- a/pkgs/tools/misc/charasay/default.nix +++ b/pkgs/tools/misc/charasay/default.nix @@ -2,6 +2,7 @@ , rustPlatform , fetchFromGitHub , installShellFiles +, stdenv }: rustPlatform.buildRustPackage rec { @@ -23,11 +24,11 @@ rustPlatform.buildRustPackage rec { rm .cargo/config.toml ''; - postInstall = '' - installShellCompletion --cmd himalaya \ - --bash <($out/bin/chara completion --shell bash) \ - --fish <($out/bin/chara completion --shell fish) \ - --zsh <($out/bin/chara completion --shell zsh) + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + installShellCompletion --cmd chara \ + --bash <($out/bin/chara completions --shell bash) \ + --fish <($out/bin/chara completions --shell fish) \ + --zsh <($out/bin/chara completions --shell zsh) ''; meta = with lib; { diff --git a/pkgs/tools/misc/dotter/default.nix b/pkgs/tools/misc/dotter/default.nix index ec8232ffc0fd6..5dc48bfaf0205 100644 --- a/pkgs/tools/misc/dotter/default.nix +++ b/pkgs/tools/misc/dotter/default.nix @@ -25,7 +25,7 @@ rustPlatform.buildRustPackage rec { nativeCheckInputs = [ which installShellFiles ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd dotter \ --bash <($out/bin/dotter gen-completions --shell bash) \ --fish <($out/bin/dotter gen-completions --shell fish) \ diff --git a/pkgs/tools/misc/intermodal/default.nix b/pkgs/tools/misc/intermodal/default.nix index e4a296333569d..c15d529279da5 100644 --- a/pkgs/tools/misc/intermodal/default.nix +++ b/pkgs/tools/misc/intermodal/default.nix @@ -18,7 +18,7 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ installShellFiles ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd imdl \ --bash <($out/bin/imdl completions bash) \ --fish <($out/bin/imdl completions fish) \ diff --git a/pkgs/tools/misc/miniserve/default.nix b/pkgs/tools/misc/miniserve/default.nix index 0bdbd91a1dc67..937f667c2a9aa 100644 --- a/pkgs/tools/misc/miniserve/default.nix +++ b/pkgs/tools/misc/miniserve/default.nix @@ -41,7 +41,7 @@ rustPlatform.buildRustPackage rec { "--skip=validate_printed_urls" ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' $out/bin/miniserve --print-manpage >miniserve.1 installManPage miniserve.1 diff --git a/pkgs/tools/misc/onefetch/default.nix b/pkgs/tools/misc/onefetch/default.nix index 84762c8b72747..0e7175e6365a7 100644 --- a/pkgs/tools/misc/onefetch/default.nix +++ b/pkgs/tools/misc/onefetch/default.nix @@ -47,7 +47,7 @@ rustPlatform.buildRustPackage rec { git commit -m test ''; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd onefetch \ --bash <($out/bin/onefetch --generate bash) \ --fish <($out/bin/onefetch --generate fish) \ diff --git a/pkgs/tools/misc/sheldon/default.nix b/pkgs/tools/misc/sheldon/default.nix index 39c6f20822219..3c0618f3de6f3 100644 --- a/pkgs/tools/misc/sheldon/default.nix +++ b/pkgs/tools/misc/sheldon/default.nix @@ -50,7 +50,7 @@ rustPlatform.buildRustPackage rec { "--skip lock_and_source_profiles" ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd sheldon \ --bash <($out/bin/sheldon completions --shell bash) \ --zsh <($out/bin/sheldon completions --shell zsh) diff --git a/pkgs/tools/misc/starship/default.nix b/pkgs/tools/misc/starship/default.nix index e322e03ed3e2b..37d38016b8829 100644 --- a/pkgs/tools/misc/starship/default.nix +++ b/pkgs/tools/misc/starship/default.nix @@ -34,14 +34,14 @@ rustPlatform.buildRustPackage rec { ''; postInstall = '' + presetdir=$out/share/starship/presets/ + mkdir -p $presetdir + cp docs/public/presets/toml/*.toml $presetdir + '' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd starship \ --bash <($out/bin/starship completions bash) \ --fish <($out/bin/starship completions fish) \ --zsh <($out/bin/starship completions zsh) - - presetdir=$out/share/starship/presets/ - mkdir -p $presetdir - cp docs/public/presets/toml/*.toml $presetdir ''; cargoHash = "sha256-yJ32HFaRpujJ9mQa+07b5cQcl1ATO/56dpm1IeKcbzs="; diff --git a/pkgs/tools/misc/topgrade/default.nix b/pkgs/tools/misc/topgrade/default.nix index 8b037912a80da..38e1f0d95c1a2 100644 --- a/pkgs/tools/misc/topgrade/default.nix +++ b/pkgs/tools/misc/topgrade/default.nix @@ -36,7 +36,7 @@ rustPlatform.buildRustPackage rec { "AppKit" ]); - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd topgrade \ --bash <($out/bin/topgrade --gen-completion bash) \ --fish <($out/bin/topgrade --gen-completion fish) \ diff --git a/pkgs/tools/misc/trashy/default.nix b/pkgs/tools/misc/trashy/default.nix index f9cfdd6127618..09cbccb13c77a 100644 --- a/pkgs/tools/misc/trashy/default.nix +++ b/pkgs/tools/misc/trashy/default.nix @@ -1,4 +1,4 @@ -{ lib, rustPlatform, fetchCrate, installShellFiles }: +{ lib, rustPlatform, fetchCrate, installShellFiles, stdenv }: rustPlatform.buildRustPackage rec { pname = "trashy"; @@ -13,7 +13,7 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ installShellFiles ]; - preFixup = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd trash \ --bash <($out/bin/trash completions bash) \ --fish <($out/bin/trash completions fish) \ diff --git a/pkgs/tools/misc/tremor-rs/default.nix b/pkgs/tools/misc/tremor-rs/default.nix index 62ddf4e725e68..65ba3a8374742 100644 --- a/pkgs/tools/misc/tremor-rs/default.nix +++ b/pkgs/tools/misc/tremor-rs/default.nix @@ -50,6 +50,7 @@ rustPlatform.buildRustPackage rec { # Copy the standard library to $out/lib cp -r ${src}/tremor-script/lib/ $out + '' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd tremor \ --bash <($out/bin/tremor completions bash) \ --fish <($out/bin/tremor completions fish) \ diff --git a/pkgs/tools/misc/twm/default.nix b/pkgs/tools/misc/twm/default.nix index 213378e41f051..7de3ed1b3b274 100644 --- a/pkgs/tools/misc/twm/default.nix +++ b/pkgs/tools/misc/twm/default.nix @@ -25,7 +25,7 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ pkg-config installShellFiles ]; buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ Security ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd twm \ --bash <($out/bin/twm --print-bash-completion) \ --zsh <($out/bin/twm --print-zsh-completion) \ diff --git a/pkgs/tools/misc/zellij/default.nix b/pkgs/tools/misc/zellij/default.nix index ca2ababb464b3..105d35349eb9b 100644 --- a/pkgs/tools/misc/zellij/default.nix +++ b/pkgs/tools/misc/zellij/default.nix @@ -50,6 +50,7 @@ rustPlatform.buildRustPackage rec { mandown docs/MANPAGE.md > zellij.1 installManPage zellij.1 + '' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd $pname \ --bash <($out/bin/zellij setup --generate-completion bash) \ --fish <($out/bin/zellij setup --generate-completion fish) \ diff --git a/pkgs/tools/networking/magic-wormhole-rs/default.nix b/pkgs/tools/networking/magic-wormhole-rs/default.nix index 77bb8e117e6f8..fc0ceebc714e6 100644 --- a/pkgs/tools/networking/magic-wormhole-rs/default.nix +++ b/pkgs/tools/networking/magic-wormhole-rs/default.nix @@ -28,7 +28,7 @@ rustPlatform.buildRustPackage rec { # all tests involve networking and are bound fail doCheck = false; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd wormhole-rs \ --bash <($out/bin/wormhole-rs completion bash) \ --fish <($out/bin/wormhole-rs completion fish) \ diff --git a/pkgs/tools/nix/fh/default.nix b/pkgs/tools/nix/fh/default.nix index 2a3e1d9e5a4d2..6bfce50581f9d 100644 --- a/pkgs/tools/nix/fh/default.nix +++ b/pkgs/tools/nix/fh/default.nix @@ -35,7 +35,7 @@ rustPlatform.buildRustPackage rec { NIX_CFLAGS_COMPILE = "-I${lib.getDev libcxx}/include/c++/v1"; }; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd fh \ --bash <($out/bin/fh completion bash) \ --fish <($out/bin/fh completion fish) \ diff --git a/pkgs/tools/package-management/nix-template/default.nix b/pkgs/tools/package-management/nix-template/default.nix index 60f08b8db6bc0..91c1f9b268078 100644 --- a/pkgs/tools/package-management/nix-template/default.nix +++ b/pkgs/tools/package-management/nix-template/default.nix @@ -35,6 +35,7 @@ rustPlatform.buildRustPackage rec { wrapProgram $out/bin/nix-template \ --prefix PATH : ${lib.makeBinPath [ nix ]} + '' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd nix-template \ --bash <($out/bin/nix-template completions bash) \ --fish <($out/bin/nix-template completions fish) \ diff --git a/pkgs/tools/security/bws/default.nix b/pkgs/tools/security/bws/default.nix index aef7a39de2809..4621bb1da5d01 100644 --- a/pkgs/tools/security/bws/default.nix +++ b/pkgs/tools/security/bws/default.nix @@ -55,7 +55,7 @@ rustPlatform.buildRustPackage rec { cargoTestFlags = [ "--package" "bws" ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd bws \ --bash <($out/bin/bws completions bash) \ --fish <($out/bin/bws completions fish) \ diff --git a/pkgs/tools/security/jwt-cli/default.nix b/pkgs/tools/security/jwt-cli/default.nix index db049b1fa7121..9eb65ffef46f3 100644 --- a/pkgs/tools/security/jwt-cli/default.nix +++ b/pkgs/tools/security/jwt-cli/default.nix @@ -17,7 +17,7 @@ rustPlatform.buildRustPackage rec { buildInputs = lib.optional stdenv.isDarwin Security; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd jwt \ --bash <($out/bin/jwt completion bash) \ --fish <($out/bin/jwt completion fish) \ diff --git a/pkgs/tools/security/kbs2/default.nix b/pkgs/tools/security/kbs2/default.nix index 4f193d4ffccb0..ae16b3f00c9ad 100644 --- a/pkgs/tools/security/kbs2/default.nix +++ b/pkgs/tools/security/kbs2/default.nix @@ -39,6 +39,7 @@ rustPlatform.buildRustPackage rec { postInstall = '' mkdir -p $out/share/kbs2 cp -r contrib/ $out/share/kbs2 + '' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd kbs2 \ --bash <($out/bin/kbs2 --completions bash) \ --fish <($out/bin/kbs2 --completions fish) \ diff --git a/pkgs/tools/security/prs/default.nix b/pkgs/tools/security/prs/default.nix index 39a629cb707c8..02f6d0725f907 100644 --- a/pkgs/tools/security/prs/default.nix +++ b/pkgs/tools/security/prs/default.nix @@ -10,6 +10,7 @@ , gtk3 , libxcb , libxkbcommon +, stdenv }: rustPlatform.buildRustPackage rec { @@ -44,7 +45,7 @@ rustPlatform.buildRustPackage rec { libxkbcommon ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' for shell in bash fish zsh; do installShellCompletion --cmd prs --$shell <($out/bin/prs internal completions $shell --stdout) done diff --git a/pkgs/tools/security/rbw/default.nix b/pkgs/tools/security/rbw/default.nix index e46b742ee1279..2de9d9ce9d5e4 100644 --- a/pkgs/tools/security/rbw/default.nix +++ b/pkgs/tools/security/rbw/default.nix @@ -51,6 +51,7 @@ rustPlatform.buildRustPackage rec { postInstall = '' install -Dm755 -t $out/bin bin/git-credential-rbw + '' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd rbw \ --bash <($out/bin/rbw gen-completions bash) \ --fish <($out/bin/rbw gen-completions fish) \ diff --git a/pkgs/tools/security/sheesy-cli/default.nix b/pkgs/tools/security/sheesy-cli/default.nix index bbe43cb697703..9df5da79e8a6c 100644 --- a/pkgs/tools/security/sheesy-cli/default.nix +++ b/pkgs/tools/security/sheesy-cli/default.nix @@ -24,7 +24,7 @@ rustPlatform.buildRustPackage rec { cargoBuildFlags = [ "--bin" "sy" ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd sy \ --bash <($out/bin/sy completions bash) \ --fish <($out/bin/sy completions fish) \ diff --git a/pkgs/tools/security/shisho/default.nix b/pkgs/tools/security/shisho/default.nix index a4635b0363e5f..f5a137a84671b 100644 --- a/pkgs/tools/security/shisho/default.nix +++ b/pkgs/tools/security/shisho/default.nix @@ -3,6 +3,7 @@ , rustPlatform , installShellFiles , rustfmt +, stdenv }: rustPlatform.buildRustPackage rec { @@ -24,7 +25,7 @@ rustPlatform.buildRustPackage rec { rustfmt ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd shisho \ --bash <($out/bin/shisho completion bash) \ --fish <($out/bin/shisho completion fish) \ diff --git a/pkgs/tools/text/languagetool-rust/default.nix b/pkgs/tools/text/languagetool-rust/default.nix index eda1060320c80..1772f9d1e3058 100644 --- a/pkgs/tools/text/languagetool-rust/default.nix +++ b/pkgs/tools/text/languagetool-rust/default.nix @@ -68,7 +68,7 @@ rustPlatform.buildRustPackage rec { "--skip=test_words_delete" ]; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd ltrs \ --bash <($out/bin/ltrs completions bash) \ --fish <($out/bin/ltrs completions fish) \ diff --git a/pkgs/tools/text/termbook/default.nix b/pkgs/tools/text/termbook/default.nix index d16dc05cba53b..437016e25ec23 100644 --- a/pkgs/tools/text/termbook/default.nix +++ b/pkgs/tools/text/termbook/default.nix @@ -43,7 +43,7 @@ rustPlatform.buildRustPackage rec { ln -sf ${./Cargo.lock} Cargo.lock ''; - postInstall = '' + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installShellCompletion --cmd termbook \ --bash <($out/bin/termbook completions bash) \ --fish <($out/bin/termbook completions fish) \