netbird: disable shell completion generation when cross compiling (#377572)

Prevent build error when cross compiling:
```
Running phase: installPhase
@nix { "action": "setPhase", "phase": "installPhase" }
/nix/store/gi58xbi7md9sb5gshvnjdkv9n0b3znrw-stdenv-linux/setup: line 228: /nix/store/rpmnk1a3n9ks4d5fj0sr5fkp9nfzdcca-netbird-riscv64-unknown-linux-gnu-0.35.2/bin/netbird: cannot execute binary file: Exec format error
/nix/store/gi58xbi7md9sb5gshvnjdkv9n0b3znrw-stdenv-linux/setup: line 228: /nix/store/rpmnk1a3n9ks4d5fj0sr5fkp9nfzdcca-netbird-riscv64-unknown-linux-gnu-0.35.2/bin/netbird: cannot execute binary file: Exec format error
/nix/store/gi58xbi7md9sb5gshvnjdkv9n0b3znrw-stdenv-linux/setup: line 228: /nix/store/rpmnk1a3n9ks4d5fj0sr5fkp9nfzdcca-netbird-riscv64-unknown-linux-gnu-0.35.2/bin/netbird: cannot execute binary file: Exec format error
installShellCompletion: installed shell completion file `/nix/store/rpmnk1a3n9ks4d5fj0sr5fkp9nfzdcca-netbird-riscv64-unknown-linux-gnu-0.35.2/share/bash-completion/completions/netbird.bash' does not exist or has zero size
```

Inspired by https://github.com/NixOS/nixpkgs/pull/186436.
This commit is contained in:
Dennis Schridde
2025-01-28 17:49:28 +02:00
committed by GitHub
parent 3dad8067ab
commit 586285a356
+1 -1
View File
@@ -91,7 +91,7 @@ buildGoModule rec {
''
mv $out/bin/${lib.last (lib.splitString "/" module)} $out/bin/${binary}
''
+ lib.optionalString (!ui) ''
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform && !ui) ''
installShellCompletion --cmd ${binary} \
--bash <($out/bin/${binary} completion bash) \
--fish <($out/bin/${binary} completion fish) \