Skip to content

gitFull: fix cross compilation evaluate and build#432788

Merged
doronbehar merged 1 commit intoNixOS:stagingfrom
doronbehar:pkg/gitFull
Aug 15, 2025
Merged

gitFull: fix cross compilation evaluate and build#432788
doronbehar merged 1 commit intoNixOS:stagingfrom
doronbehar:pkg/gitFull

Conversation

@doronbehar
Copy link
Contributor

Description of changes

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@ofborg ofborg bot added the 6.topic: cross-compilation Building packages on a different platform than they will be used on label Aug 11, 2025
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 9.needs: reviewer This PR currently has no reviewers requested and needs attention. labels Aug 11, 2025
Copy link
Contributor

@uninsane uninsane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't build yet, but failed build is better than failed eval IMO.

$ nix-build -A pkgsCross.aarch64-multiplatform.gitFull
make: Entering directory '/build/git-2.50.1/contrib/credential/libsecret'
/nix/store/gkwbw9nzbkbz298njbn3577zmrnglbbi-bash-5.3p0/bin/bash: line 1: pkg-config: command not found
/nix/store/gkwbw9nzbkbz298njbn3577zmrnglbbi-bash-5.3p0/bin/bash: line 1: pkg-config: command not found
aarch64-unknown-linux-gnu-gcc -g -O2   -o git-credential-libsecret.o -c git-credential-libsecret.c
git-credential-libsecret.c:29:10: fatal error: glib.h: No such file or directory
   29 | #include <glib.h>
      |          ^~~~~~~~
compilation terminated.
make: *** [Makefile:22: git-credential-libsecret.o] Error 1
make: Leaving directory '/build/git-2.50.1/contrib/credential/libsecret'
error: build of '/nix/store/795445jzkw1ilfwhscwvn30klndb39cf-git-aarch64-unknown-linux-gnu-2.50.1.drv' failed with exit code 2;

@nixpkgs-ci nixpkgs-ci bot added 12.approvals: 1 This PR was reviewed and approved by one person. and removed 9.needs: reviewer This PR currently has no reviewers requested and needs attention. labels Aug 14, 2025
@uninsane
Copy link
Contributor

$ nix-build -A pkgsCross.aarch64-multiplatform.gitFull
make: Entering directory '/build/git-2.50.1/contrib/credential/libsecret'
/nix/store/gkwbw9nzbkbz298njbn3577zmrnglbbi-bash-5.3p0/bin/bash: line 1: pkg-config: command not found
/nix/store/gkwbw9nzbkbz298njbn3577zmrnglbbi-bash-5.3p0/bin/bash: line 1: pkg-config: command not found
aarch64-unknown-linux-gnu-gcc -g -O2 -o git-credential-libsecret.o -c git-credential-libsecret.c
git-credential-libsecret.c:29:10: fatal error: glib.h: No such file or directory
29 | #include <glib.h>
| ^~~~~~~~
compilation terminated.
make: *** [Makefile:22: git-credential-libsecret.o] Error 1
make: Leaving directory '/build/git-2.50.1/contrib/credential/libsecret'
error: build of '/nix/store/795445jzkw1ilfwhscwvn30klndb39cf-git-aarch64-unknown-linux-gnu-2.50.1.drv' failed with exit code 2;

if i apply this patch on top of your PR, then pkgsCross.aarch64-multiplatform.gitFull builds!

diff --git pkgs/applications/version-management/git/default.nix pkgs/applications/version-management/git/default.nix
index 93452cac87f2..67e7e9924c10 100644
--- pkgs/applications/version-management/git/default.nix
+++ pkgs/applications/version-management/git/default.nix
@@ -115,6 +115,8 @@ stdenv.mkDerivation (finalAttrs: {
     # Fix references to gettext introduced by ./git-sh-i18n.patch
     substituteInPlace git-sh-i18n.sh \
         --subst-var-by gettext ${gettext}
+    substituteInPlace contrib/credential/libsecret/Makefile \
+        --replace-fail 'pkg-config' "$PKG_CONFIG"
   ''
   + lib.optionalString doInstallCheck ''
     # ensure we are using the correct shell when executing the test scripts

@doronbehar
Copy link
Contributor Author

doronbehar commented Aug 14, 2025

Thanks a lot @uninsane! Your patch was applied. Will merge when CI is green.

@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. and removed 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Aug 14, 2025
@philiptaron
Copy link
Contributor

Has to target staging now

@doronbehar doronbehar changed the title gitFull: Make it (at least) evaluate when cross compiling gitFull: fix cross compilation evaluate and build Aug 14, 2025
@uninsane
Copy link
Contributor

@doronbehar 5000+ rebuild count -- you'll want to either retarget to staging, or make the new postPatch string conditional on hostPlatform != buildPlatform.

@doronbehar doronbehar changed the base branch from master to staging August 14, 2025 22:06
@nixpkgs-ci nixpkgs-ci bot closed this Aug 14, 2025
@nixpkgs-ci nixpkgs-ci bot reopened this Aug 14, 2025
@doronbehar
Copy link
Contributor Author

Right - it changes both git and gitFull. I don't mind go through staging and not use a platform conditional - this change is correct either way. Thanks for commenting about this though.

Copy link
Contributor

@philiptaron philiptaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple questions about the original change.

# The full-featured Git.
gitFull = git.override {
svnSupport = true;
svnSupport = stdenv.buildPlatform == stdenv.hostPlatform;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this the case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because otherwise:

$ nix build -Lf. pkgsCross.aarch64-multiplatform.gitFull
error:
       … while calling a functor (an attribute set with a '__functor' attribute)
         at /home/doron/repos/nixpkgs/pkgs/top-level/all-packages.nix:1204:13:
         1203|   # The full-featured Git.
         1204|   gitFull = git.override {
             |             ^
         1205|     svnSupport = true;

       … while calling a functor (an attribute set with a '__functor' attribute)
         at /home/doron/repos/nixpkgs/lib/customisation.nix:169:45:
          168|         # Re-call the function but with different arguments
          169|         overrideArgs = mirrorArgs (newArgs: makeOverridable f (overrideWith newArgs));
             |                                             ^
          170|         # Change the result of the function call by applying g to it

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: assertion '(sendEmailSupport -> perlSupport)' failed
       at /home/doron/repos/nixpkgs/pkgs/applications/version-management/git/default.nix:59:1:
           58| assert osxkeychainSupport -> stdenv.hostPlatform.isDarwin;
           59| assert sendEmailSupport -> perlSupport;
             | ^
           60| assert svnSupport -> perlSupport;

And:

perlSupport ? stdenv.buildPlatform == stdenv.hostPlatform,

But gitFull from some reason enabled that unconditionally.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sort of shocked at that default for Perl support. I've added it to the notebook for "why is this the case".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to Google git add -i and git add -p are an example for pretty basic commands that require Perl. For those on a diet we have gitMinimal.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thing is, we can absolutely make a working Perl with cross-compilation… I think‽ It's likely just an insufficiently substituted set of paths, I would think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to agree, but that can be done in a separate PR. Even if I had the motivation to do it, I would have committed exactly the same commit as committed now, before fixing the cross compilation with Perl support.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, makes sense. Not blocking. Just a bit shocking to me.

@doronbehar doronbehar merged commit ee93e7a into NixOS:staging Aug 15, 2025
52 of 57 checks passed
@me-and me-and mentioned this pull request Aug 19, 2025
15 tasks
@trofi
Copy link
Contributor

trofi commented Dec 25, 2025

Bisect says there is a tiny eval regression around pkgsLLVM.git-doc. Attempted to fix it as:

@doronbehar doronbehar deleted the pkg/gitFull branch February 10, 2026 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: cross-compilation Building packages on a different platform than they will be used on 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants