zarf: fix shell completions on Darwin (#446215)

authored by Aleksana and committed by GitHub 9b40f06b ba6b7687

+15 -10
+15 -10
pkgs/by-name/za/zarf/package.nix
··· 2 2 lib, 3 3 buildGoModule, 4 4 fetchFromGitHub, 5 + iana-etc, 5 6 installShellFiles, 7 + libredirect, 6 8 stdenv, 7 9 }: 8 10 ··· 20 22 vendorHash = "sha256-As7xDEo+bMslv9Xd6CbHTqvf2XaXmO6Gp3f9+xD3kNU="; 21 23 proxyVendor = true; 22 24 23 - nativeBuildInputs = [ installShellFiles ]; 25 + nativeBuildInputs = [ 26 + installShellFiles 27 + ] 28 + ++ lib.optionals stdenv.hostPlatform.isDarwin [ libredirect.hook ]; 24 29 25 30 preBuild = '' 26 31 mkdir -p build/ui ··· 43 48 "k8s.io/component-base/version.buildDate=1970-01-01T00:00:00Z" 44 49 ]; 45 50 46 - # Breaks with sandbox on Darwin because it wants to read /etc/protocols 47 51 postInstall = 48 52 lib.optionalString 49 - ((stdenv.buildPlatform.canExecute stdenv.hostPlatform) && !stdenv.buildPlatform.isDarwin) 50 - '' 51 - export K9S_LOGS_DIR=$(mktemp -d) 52 - installShellCompletion --cmd zarf \ 53 - --bash <($out/bin/zarf completion bash) \ 54 - --fish <($out/bin/zarf completion fish) \ 55 - --zsh <($out/bin/zarf completion zsh) 56 - ''; 53 + (stdenv.buildPlatform.canExecute stdenv.hostPlatform && stdenv.hostPlatform.isDarwin) 54 + "export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/services=${iana-etc}/etc/services" 55 + + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' 56 + export K9S_LOGS_DIR=$(mktemp -d) 57 + installShellCompletion --cmd zarf \ 58 + --bash <($out/bin/zarf completion bash) \ 59 + --fish <($out/bin/zarf completion fish) \ 60 + --zsh <($out/bin/zarf completion zsh) 61 + ''; 57 62 58 63 meta = with lib; { 59 64 description = "DevSecOps for Air Gap & Limited-Connection Systems. https://zarf.dev";