From bbe694f8ea6f47bdff43000d3aa7aa0a590892f2 Mon Sep 17 00:00:00 2001 From: Palmer Cox Date: Fri, 5 Jun 2026 01:35:38 +0000 Subject: [PATCH] git: Fix cross compilation The problem was that Cargo didn't have a way to find a linker for the build platform which is required to link the build script. So, when cross compiling we add in the standard build -> build compiler so that it can compile the build script. This fix was taken from the ideas of @magicquark and @nwf in https://github.com/NixOS/nixpkgs/issues/523378. Fixes #523378 --- pkgs/by-name/gi/git/package.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/by-name/gi/git/package.nix b/pkgs/by-name/gi/git/package.nix index fa7bcc7cd054..6721c2110439 100644 --- a/pkgs/by-name/gi/git/package.nix +++ b/pkgs/by-name/gi/git/package.nix @@ -212,6 +212,11 @@ stdenv.mkDerivation (finalAttrs: { libsecret ]; + # This is required for building the rust build.rs script when cross compiling + depsBuildBuild = lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ + buildPackages.stdenv.cc + ]; + env = { # required to support pthread_cancel() NIX_LDFLAGS =