From d542ef406161bcc79b9a4bc2c38ecc496c8958d4 Mon Sep 17 00:00:00 2001 From: Colin Date: Sat, 18 Jul 2026 21:13:45 +0000 Subject: [PATCH] delta: fix cross compilation fixes `nix-build -A pkgsCross.aarch64-multiplatform.delta` the pattern to use an emulator when generating shell completions is well-established, see e.g. pkgs/by-name/st/starship/package.nix. it evaluates to a lightweight `exec "$@"` when emulation isn't required. --- pkgs/by-name/de/delta/package.nix | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pkgs/by-name/de/delta/package.nix b/pkgs/by-name/de/delta/package.nix index 3506927618c3..181fed03a40c 100644 --- a/pkgs/by-name/de/delta/package.nix +++ b/pkgs/by-name/de/delta/package.nix @@ -1,6 +1,7 @@ { lib, rustPlatform, + buildPackages, fetchFromGitHub, installShellFiles, pkg-config, @@ -42,12 +43,17 @@ rustPlatform.buildRustPackage (finalAttrs: { RUSTONIG_SYSTEM_LIBONIG = true; }; - postInstall = '' - installShellCompletion --cmd delta \ - --bash <($out/bin/delta --generate-completion bash) \ - --fish <($out/bin/delta --generate-completion fish) \ - --zsh <($out/bin/delta --generate-completion zsh) - ''; + postInstall = lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) ( + let + emulator = stdenv.hostPlatform.emulator buildPackages; + in + '' + installShellCompletion --cmd delta \ + --bash <(${emulator} $out/bin/delta --generate-completion bash) \ + --fish <(${emulator} $out/bin/delta --generate-completion fish) \ + --zsh <(${emulator} $out/bin/delta --generate-completion zsh) + '' + ); # test_env_parsing_with_pager_set_to_bat sets environment variables, # which can be flaky with multiple threads: