From 586285a35618cbdb9aed4d5e90a2e6c00a70cd84 Mon Sep 17 00:00:00 2001 From: Dennis Schridde <63082+devurandom@users.noreply.github.com> Date: Tue, 28 Jan 2025 16:49:28 +0100 Subject: [PATCH] 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. --- pkgs/tools/networking/netbird/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/tools/networking/netbird/default.nix b/pkgs/tools/networking/netbird/default.nix index e11a548eb4aa..a66390a16e3e 100644 --- a/pkgs/tools/networking/netbird/default.nix +++ b/pkgs/tools/networking/netbird/default.nix @@ -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) \