Skip to content

nixVersions.nix_2_26: fix cross#392832

Merged
Mic92 merged 3 commits intoNixOS:masterfrom
roberth:nix-cross
Mar 26, 2025
Merged

nixVersions.nix_2_26: fix cross#392832
Mic92 merged 3 commits intoNixOS:masterfrom
roberth:nix-cross

Conversation

@roberth
Copy link
Member

@roberth roberth commented Mar 24, 2025

This contains a formatting commit, so best to review the commits individually.

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)
    • sandbox = relaxed
    • sandbox = true
  • 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/)
  • 25.05 Release Notes (or backporting 24.11 and 25.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 Mar 24, 2025
@roberth
Copy link
Member Author

roberth commented Mar 24, 2025

@ofborg build pkgsCross.armv7l-hf-multiplatform.nixVersions.nix_2_26
@ofborg build pkgsStatic.nixVersions.nix_2_26
@ofborg build nixVersions.nix_2_26

@github-actions github-actions 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. labels Mar 24, 2025
Copy link
Member Author

Choose a reason for hiding this comment

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

Exposing the components as a first-class scope is required for cross compilation.

@wegank wegank added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Mar 25, 2025
@Mic92 Mic92 merged commit f7a715c into NixOS:master Mar 26, 2025
31 of 41 checks passed
@nixpkgs-ci
Copy link
Contributor

nixpkgs-ci bot commented Mar 26, 2025

Backport failed for release-24.11, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release-24.11
git worktree add -d .worktree/backport-392832-to-release-24.11 origin/release-24.11
cd .worktree/backport-392832-to-release-24.11
git switch --create backport-392832-to-release-24.11
git cherry-pick -x c0df86f0ab7460fd64f5789f1b92d189eb16305d e9494dd2232526279f6229d3f1ce3b6da1609cb3 ac543ea035a0d6b3b8dc5187d82a04fc06c78d20

@K900
Copy link
Contributor

K900 commented Mar 26, 2025

This broke eval. Reverting for now.

❯ nom-build pkgs/top-level/release.nix -A tarball
error:
       … while evaluating an expression to select 'drvPath' on it
         at «internal»:1:552:
       … while calling the 'derivationStrict' builtin
         at «internal»:1:208:
       … while evaluating derivation 'nixpkgs-tarball-25.05pre1234.abcdef'
         whose name attribute is located at /home/k900/gh/NixOS/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:375:7

       … while evaluating attribute 'buildInputs' of derivation 'nixpkgs-tarball-25.05pre1234.abcdef'
         at /home/k900/gh/NixOS/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:422:7:
          421|       depsHostHost                = elemAt (elemAt dependencies 1) 0;
          422|       buildInputs                 = elemAt (elemAt dependencies 1) 1;
             |       ^
          423|       depsTargetTarget            = elemAt (elemAt dependencies 2) 0;

       … while calling the 'getAttr' builtin
         at «internal»:1:500:
       … while calling the 'derivationStrict' builtin
         at «internal»:1:208:
       … while evaluating derivation 'nixpkgs-lib-tests'
         whose name attribute is located at /home/k900/gh/NixOS/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:375:7

       … while evaluating attribute 'paths' of derivation 'nixpkgs-lib-tests'
         at /home/k900/gh/NixOS/nixpkgs/pkgs/build-support/trivial-builders/default.nix:542:9:
          541|         inherit preferLocalBuild allowSubstitutes;
          542|         paths = mapPaths (path: "${path}${stripPrefix}") paths;
             |         ^
          543|         passAsFile = [ "paths" ];

       … while calling anonymous lambda
         at /home/k900/gh/NixOS/nixpkgs/pkgs/build-support/trivial-builders/default.nix:534:33:
          533|     let
          534|       mapPaths = f: paths: map (path:
             |                                 ^
          535|         if path == null then null

       … from call site
         at /home/k900/gh/NixOS/nixpkgs/pkgs/build-support/trivial-builders/default.nix:537:14:
          536|         else if isList path then mapPaths f path
          537|         else f path
             |              ^
          538|       ) paths;

       … while calling anonymous lambda
         at /home/k900/gh/NixOS/nixpkgs/pkgs/build-support/trivial-builders/default.nix:542:27:
          541|         inherit preferLocalBuild allowSubstitutes;
          542|         paths = mapPaths (path: "${path}${stripPrefix}") paths;
             |                           ^
          543|         passAsFile = [ "paths" ];

       … while calling the 'getAttr' builtin
         at «internal»:1:500:
       … while calling the 'derivationStrict' builtin
         at «internal»:1:208:
       … while evaluating the derivation attribute 'name'
         at /home/k900/gh/NixOS/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:375:7:
          374|     // (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          375|       name =
             |       ^
          376|         let

       … while evaluating the `name` attribute passed to builtins.derivationStrict

       … from call site
         at /home/k900/gh/NixOS/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:393:9:
          392|         in
          393|         lib.strings.sanitizeDerivationName (
             |         ^
          394|           if attrs ? name

       … while calling anonymous lambda
         at /home/k900/gh/NixOS/nixpkgs/lib/strings.nix:2704:3:
         2703|   in
         2704|   string:
             |   ^
         2705|   # First detect the common case of already valid strings, to speed those up

       … while evaluating a branch condition
         at /home/k900/gh/NixOS/nixpkgs/lib/strings.nix:2706:3:
         2705|   # First detect the common case of already valid strings, to speed those up
         2706|   if stringLength string <= 207 && okRegex string != null
             |   ^
         2707|   then unsafeDiscardStringContext string

       … in the left operand of the AND (&&) operator
         at /home/k900/gh/NixOS/nixpkgs/lib/strings.nix:2706:33:
         2705|   # First detect the common case of already valid strings, to speed those up
         2706|   if stringLength string <= 207 && okRegex string != null
             |                                 ^
         2707|   then unsafeDiscardStringContext string

       … in the argument of the not operator
         at /home/k900/gh/NixOS/nixpkgs/lib/strings.nix:2706:26:
         2705|   # First detect the common case of already valid strings, to speed those up
         2706|   if stringLength string <= 207 && okRegex string != null
             |                          ^
         2707|   then unsafeDiscardStringContext string

       … while calling the 'lessThan' builtin
         at /home/k900/gh/NixOS/nixpkgs/lib/strings.nix:2706:26:
         2705|   # First detect the common case of already valid strings, to speed those up
         2706|   if stringLength string <= 207 && okRegex string != null
             |                          ^
         2707|   then unsafeDiscardStringContext string

       … while calling the 'stringLength' builtin
         at /home/k900/gh/NixOS/nixpkgs/lib/strings.nix:2706:6:
         2705|   # First detect the common case of already valid strings, to speed those up
         2706|   if stringLength string <= 207 && okRegex string != null
             |      ^
         2707|   then unsafeDiscardStringContext string

       … while evaluating the attribute 'name'
         at /home/k900/gh/NixOS/nixpkgs/pkgs/build-support/trivial-builders/default.nix:63:30:
           62|         enableParallelBuilding = true;
           63|         inherit buildCommand name;
             |                              ^
           64|         passAsFile = [ "buildCommand" ]

       … while evaluating an expression to select 'version' on it
         at /home/k900/gh/NixOS/nixpkgs/lib/tests/test-with-nix.nix:17:42:
           16|
           17| pkgs.runCommand "nixpkgs-lib-tests-nix-${nix.version}"
             |                                          ^
           18|   {

       … from call site
         at /home/k900/gh/NixOS/nixpkgs/lib/tests/release.nix:8:65:
            7|   nix ? pkgs-nixVersions.stable,
            8|   nixVersions ? [ pkgs-nixVersions.minimum nix pkgs-nixVersions.latest ],
             |                                                                 ^
            9|   pkgs-nixVersions ? import ./nix-for-tests.nix { pkgs = pkgsBB; },

       … while calling anonymous lambda
         at /home/k900/gh/NixOS/nixpkgs/lib/tests/nix-for-tests.nix:15:6:
           14| builtins.mapAttrs (
           15|   _: pkg: if builtins.isAttrs pkg then pkg.override { withAWS = false; } else pkg
             |      ^
           16| ) pkgs.nixVersions

       … while calling a functor (an attribute set with a '__functor' attribute)
         at /home/k900/gh/NixOS/nixpkgs/lib/tests/nix-for-tests.nix:15:40:
           14| builtins.mapAttrs (
           15|   _: pkg: if builtins.isAttrs pkg then pkg.override { withAWS = false; } else pkg
             |                                        ^
           16| ) pkgs.nixVersions

       … from call site
         at /home/k900/gh/NixOS/nixpkgs/lib/trivial.nix:1000:7:
          999|     { # TODO: Should we add call-time "type" checking like built in?
         1000|       __functor = self: f;
             |       ^
         1001|       __functionArgs = args;

       … while calling anonymous lambda
         at /home/k900/gh/NixOS/nixpkgs/lib/customisation.nix:169:36:
          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

       … while calling a functor (an attribute set with a '__functor' attribute)
         at /home/k900/gh/NixOS/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

       … from call site
         at /home/k900/gh/NixOS/nixpkgs/lib/trivial.nix:1000:7:
          999|     { # TODO: Should we add call-time "type" checking like built in?
         1000|       __functor = self: f;
             |       ^
         1001|       __functionArgs = args;

       … while calling anonymous lambda
         at /home/k900/gh/NixOS/nixpkgs/lib/customisation.nix:161:7:
          160|     mirrorArgs (
          161|       origArgs:
             |       ^
          162|       let

       … while evaluating a branch condition
         at /home/k900/gh/NixOS/nixpkgs/lib/customisation.nix:173:7:
          172|       in
          173|       if isAttrs result then
             |       ^
          174|         result

       … while calling the 'isAttrs' builtin
         at /home/k900/gh/NixOS/nixpkgs/lib/customisation.nix:173:10:
          172|       in
          173|       if isAttrs result then
             |          ^
          174|         result

       … from call site
         at /home/k900/gh/NixOS/nixpkgs/lib/customisation.nix:163:18:
          162|       let
          163|         result = f origArgs;
             |                  ^
          164|

       error: function 'anonymous lambda' called with unexpected argument 'withAWS'
       at /home/k900/gh/NixOS/nixpkgs/pkgs/tools/package-management/nix/vendor/2_26/packaging/everything.nix:1:1:
            1| {
             | ^
            2|   lib,

@emilazy
Copy link
Member

emilazy commented Mar 26, 2025

Can we please just have a simple derivation for 2.26 that works rather than trying to vendor a bunch of code from the Nix flake that keeps causing packaging issues…? I don’t know if we want to ship 25.05 with nixVersions.latest having this many issues.

@Ericson2314
Copy link
Member

Ericson2314 commented Mar 26, 2025

I guess the test failure came from lib/tests/nix-for-tests.nix?

Can we please just have a simple derivation for 2.26 that works rather than trying to vendor a bunch of code from the Nix flake that keeps causing packaging issues…?

IMO that is not a totally fair way to look at this. We've been writing the code with the goal of including things in Nixpkgs the whole time --- it's not a "flake first" design at all. We're going from a single "big chungus" package to a package set. Sketchy free-floating overrides like the above are bound to cause problems.

The vast majority of the code changing here is from formatting, too.

@emilazy
Copy link
Member

emilazy commented Mar 26, 2025

It really doesn’t feel like idiomatic Nixpkgs code to me, even for a large package set. There’s parts of the packaging that look load‐bearing but are pure dead code in Nixpkgs, and I think the complexity of packaging/components.nix would have generated substantial review feedback if it wasn’t just being vendored in from the Nix repository.

But I’m more concerned about the fact that the freeze is on the horizon and stuff is still broken because of it. The package wasn’t split up prior to 2.26, and I think splitting it up currently doesn’t give a practical benefit, so having a working nixVersions.latest in the next stable release should take precedence over having it split up, surely?

@emilazy
Copy link
Member

emilazy commented Mar 26, 2025

(And even if the override is sketchy, we probably should not change the public flag API of a package as central as Nix without a deprecation cycle or at least an explicit error message.)

@Ericson2314
Copy link
Member

I think splitting it up currently doesn’t give a practical benefit.

IMO there are huge practical benefits, and I wrote an RFC about better layering to spell them out, but it takes a while for these things to bake. For example, we wouldn't need any nixForLinking if everything was using the right stuff downstream.

(And even if the override is sketchy, we probably should not change the public flag API of a package as central as Nix without a deprecation cycle or at least an explicit error message.)

The "nix everything" was supposed to be the compat shim. IMO once we're fully transitioned over, nothing should be using it.

I think the complexity of packaging/components.nix would have generated substantial review feedback

I would like to do that. We're pioneering a lot of stuff, including file sets, so there are a lot of idioms to be shaken out.


But I’m more concerned about the fact that the freeze is on the horizon and stuff is still broken because of it.

Yeah, that is the frustrating part. It's been 6 months since we "just" delayed Meson for 24.11, and somehow it still feels like we are running out out of time.

@Mic92
Copy link
Member

Mic92 commented Mar 26, 2025

I think splitting it up currently doesn’t give a practical benefit.

IMO there are huge practical benefits, and I wrote an RFC about better layering to spell them out, but it takes a while for these things to bake. For example, we wouldn't need any nixForLinking if everything was using the right stuff downstream.

Getting rid of one alias doesn't seem a good enough reasons to have this much complexity in nixpkgs.

(And even if the override is sketchy, we probably should not change the public flag API of a package as central as Nix without a deprecation cycle or at least an explicit error message.)

The "nix everything" was supposed to be the compat shim. IMO once we're fully transitioned over, nothing should be using it.

I am voting for a simpler meson package until this transition is actually being finished.

I think the complexity of packaging/components.nix would have generated substantial review feedback

I would like to do that. We're pioneering a lot of stuff, including file sets, so there are a lot of idioms to be shaken out.

But I’m more concerned about the fact that the freeze is on the horizon and stuff is still broken because of it.

Yeah, that is the frustrating part. It's been 6 months since we "just" delayed Meson for 24.11, and somehow it still feels like we are running out out of time.

I also feel like I no longer have a good overview what differences between the nixpkgs and the nix repo is. There subtle different.

Ericson2314 added a commit to obsidiansystems/nixpkgs that referenced this pull request Mar 26, 2025
This was done in NixOS#392832, but then that was reverted. Want to land the
formatting right away before making the next version we hopefully don't
need to revert.
Ericson2314 added a commit that referenced this pull request Mar 26, 2025
This was done in #392832, but then that was reverted. Want to land the
formatting right away before making the next version we hopefully don't
need to revert.

(cherry picked from commit ab043a8)
@Mic92
Copy link
Member

Mic92 commented Mar 26, 2025

#393509

Ericson2314 added a commit that referenced this pull request Mar 26, 2025
This was done in #392832, but then that was reverted. Want to land the
formatting right away before making the next version we hopefully don't
need to revert.

(cherry picked from commit ab043a8)
@Ericson2314 Ericson2314 mentioned this pull request Mar 26, 2025
13 tasks
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: 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. 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nixVersions.nix_2_26: cross compilation is broken nixVersions.nix_2_26: cross-compiled nix fails to evaluate

6 participants