treewide: skip generating shell completions using $out/bin/… when cross compiling

This focuses on Rust packages, since the most commonly used argument
parser library (clap/structopt) makes the following pattern natural and
thus common:

  postInstall = ''
    installShellCompletion --cmd foo \
      --bash <($out/bin/foo completion bash) \
      …

This commit just guards those with

lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform)

splitting the string where unrelated actions are performed.
This commit is contained in:
Julius Michaelis 2024-07-10 20:52:28 +09:00
parent 59b930d820
commit 6a9beaf893
61 changed files with 84 additions and 61 deletions

View File

@ -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) \

View File

@ -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

View File

@ -51,7 +51,7 @@ rustPlatform.buildRustPackage rec {
"--skip=watcher::tests::the_gauntlet"
];
postInstall = ''
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd inlyne \
--bash completions/inlyne.bash \
--fish completions/inlyne.fish \

View File

@ -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) \

View File

@ -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) \

View File

@ -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

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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";

View File

@ -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) \

View File

@ -65,6 +65,7 @@ rustPlatform.buildRustPackage rec {
]
}"
'' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd maa \
--bash <($out/bin/maa complete bash) \
--fish <($out/bin/maa complete fish) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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)

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -2,6 +2,7 @@
, rustPlatform
, fetchFromGitHub
, installShellFiles
, stdenv
}:
rustPlatform.buildRustPackage rec {
@ -23,7 +24,7 @@ rustPlatform.buildRustPackage rec {
rm .cargo/config.toml
'';
postInstall = ''
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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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

View File

@ -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) \

View File

@ -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)

View File

@ -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=";

View File

@ -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) \

View File

@ -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 = ''
preFixup = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd trash \
--bash <($out/bin/trash completions bash) \
--fish <($out/bin/trash completions fish) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \

View File

@ -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) \