about summary refs log tree commit diff
path: root/pkgs/by-name/as
diff options
context:
space:
mode:
authorJulius Michaelis2024-07-10 20:52:28 +0900
committerJulius Michaelis2024-08-04 10:50:48 +0900
commit6a9beaf893707ea2ce653dc2bacad484f084b5ad (patch)
tree7df739aa273a8db9b759c324434fd7a79ca6540e /pkgs/by-name/as
parent59b930d820bbda1b1e83627088a45a689617581a (diff)
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.
Diffstat (limited to 'pkgs/by-name/as')
-rw-r--r--pkgs/by-name/as/ast-grep/package.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkgs/by-name/as/ast-grep/package.nix b/pkgs/by-name/as/ast-grep/package.nix
index 644ef2e284ca..ab33df30035a 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) \