Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qt6: remove stdenv fully #391178

Merged
merged 1 commit into from
Mar 20, 2025
Merged

qt6: remove stdenv fully #391178

merged 1 commit into from
Mar 20, 2025

Conversation

rhelmot
Copy link
Contributor

@rhelmot rhelmot commented Mar 19, 2025

Let's see what breaks. See #370781

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.

@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 19, 2025
@emilazy
Copy link
Member

emilazy commented Mar 19, 2025

Nothing will break in‐tree (anything that causes warnings can’t be part of the release jobset anyway), but it might break external users. We could probably get away with just making it a throw.

@rhelmot
Copy link
Contributor Author

rhelmot commented Mar 19, 2025

I think the thing I was seeing earlier was that the warnings were being triggered in-tree simply by accessing pkgsCross.x86_64-freebsd.qt6Packages.accounts-qt, so a throw would probably trip there too.

@K900
Copy link
Contributor

K900 commented Mar 19, 2025

That sounds wrong.

@rhelmot
Copy link
Contributor Author

rhelmot commented Mar 19, 2025

[+] ~/proj/nix/nixpkgs% nix-instantiate . -A pkgsCross.x86_64-freebsd.qt6Packages.accounts-qt                                                                                                                                                                                                        audrey@daisy [02:06:58 PM]
error:
       … while calling a functor (an attribute set with a '__functor' attribute)
         at /home/audrey/proj/nix/nixpkgs/lib/customisation.nix:306:7:
          305|     if missingArgs == { } then
          306|       makeOverridable f allArgs
             |       ^
          307|     # This needs to be an abort so it can't be caught with `builtins.tryEval`,

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

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

       error: Accessing the invalid property
[+] ~/proj/nix/nixpkgs% git diff                                                                                                                                                                                                                                                                     audrey@daisy [02:07:01 PM]
diff --git a/pkgs/top-level/qt6-packages.nix b/pkgs/top-level/qt6-packages.nix
index fd3606df0d75..f9a04d3d4e71 100644
--- a/pkgs/top-level/qt6-packages.nix
+++ b/pkgs/top-level/qt6-packages.nix
@@ -136,5 +136,5 @@ makeScopeWithSplicing' {
   });
 } // lib.optionalAttrs config.allowAliases {
   # when removing, don't forget to remove a workaround in `pkgs/kde/default.nix`
-  stdenv = lib.warn "qt6Packages.stdenv is deprecated. Use stdenv instead." stdenv; # Added for 25.05
+  stdenv = throw "Accessing the invalid property";
 }
[+] ~/proj/nix/nixpkgs% git status                                                                                                                                                                                                                                                                   audrey@daisy [02:07:08 PM]
On branch master
Your branch is up to date with 'upstream/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   pkgs/top-level/qt6-packages.nix

no changes added to commit (use "git add" and/or "git commit -a")
[+] ~/proj/nix/nixpkgs% git rev-parse HEAD                                                                                                                                                                                                                                                           audrey@daisy [02:07:13 PM]
7fdcf460054eb871ff8cc12aa1b7e7c561911d2e
[+] ~/proj/nix/nixpkgs%                                                                                                                                                                                                                                                                              audrey@daisy [02:07:13 PM]

Did you mean something else?

@K900
Copy link
Contributor

K900 commented Mar 20, 2025

I'm not saying it can't happen, I'm saying it shouldn't be. Something is clearly accessing it, but what? And why?

@rhelmot
Copy link
Contributor Author

rhelmot commented Mar 20, 2025

Full trace. It really looks like the stdenv is being pulled into the scope, but only for spliced package sets.

error:
       … from call site
         at /home/audrey/proj/nix/nixpkgs/pkgs/top-level/qt6-packages.nix:33:17:
           32|   # LIBRARIES
           33|   accounts-qt = callPackage ../development/libraries/accounts-qt { };
             |                 ^
           34|   appstream-qt = callPackage ../development/libraries/appstream/qt.nix { };
   … while calling 'callPackageWith'
     at /home/audrey/proj/nix/nixpkgs/lib/customisation.nix:240:19:
      239|   callPackageWith =
      240|     autoArgs: fn: args:
         |                   ^
      241|     let

   … while calling a functor (an attribute set with a '__functor' attribute)
     at /home/audrey/proj/nix/nixpkgs/lib/customisation.nix:306:7:
      305|     if missingArgs == { } then
      306|       makeOverridable f allArgs
         |       ^
      307|     # This needs to be an abort so it can't be caught with `builtins.tryEval`,

   … from call site
     at /home/audrey/proj/nix/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/audrey/proj/nix/nixpkgs/lib/customisation.nix:161:7:
      160|     mirrorArgs (
      161|       origArgs:
         |       ^
      162|       let

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

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

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

   … while calling anonymous lambda
     at /home/audrey/proj/nix/nixpkgs/pkgs/development/libraries/accounts-qt/default.nix:1:1:
        1| {
         | ^
        2|   stdenv,

   … while evaluating a branch condition
     at /home/audrey/proj/nix/nixpkgs/pkgs/top-level/splice.nix:73:11:
       72|             # on to splice them together.
       73|           if lib.isDerivation defaultValue then augmentedValue // spliceReal {
         |           ^
       74|             pkgsBuildBuild = tryGetOutputs valueBuildBuild;

   … from call site
     at /home/audrey/proj/nix/nixpkgs/pkgs/top-level/splice.nix:73:14:
       72|             # on to splice them together.
       73|           if lib.isDerivation defaultValue then augmentedValue // spliceReal {
         |              ^
       74|             pkgsBuildBuild = tryGetOutputs valueBuildBuild;

   … while calling 'isDerivation'
     at /home/audrey/proj/nix/nixpkgs/lib/attrsets.nix:1282:5:
     1281|   isDerivation =
     1282|     value: value.type or null == "derivation";
         |     ^
     1283|

   … while evaluating the attribute 'stdenv'
     at /home/audrey/proj/nix/nixpkgs/pkgs/top-level/qt6-packages.nix:139:3:
      138|   # when removing, don't forget to remove a workaround in `pkgs/kde/default.nix`
      139|   stdenv = throw "Accessing the invalid property";
         |   ^
      140| }

   … while calling the 'throw' builtin
     at /home/audrey/proj/nix/nixpkgs/pkgs/top-level/qt6-packages.nix:139:12:
      138|   # when removing, don't forget to remove a workaround in `pkgs/kde/default.nix`
      139|   stdenv = throw "Accessing the invalid property";
         |            ^
      140| }

   error: Accessing the invalid property

@K900
Copy link
Contributor

K900 commented Mar 20, 2025

This really feels like something we should try and root cause.

@rhelmot
Copy link
Contributor Author

rhelmot commented Mar 20, 2025

Tagging @Ericson2314 as the only one I've ever seen be able to wrangle splicing bullshit of this magnitude 🙏

@rhelmot
Copy link
Contributor Author

rhelmot commented Mar 20, 2025

Actually, this looks extremely straightforward. Splicing seems to be implemented such that it just re-crawls the package tree from the root in order to generate the spliced set, completely without regard for any sort of subscoping, so the fact that pkgs.qt6Packages.stdenv is accessible means that it ends up accessible as pkgsCross.x86_64-freebsd.qt6Packages.stdenv. Then, generateSplicesForMkScope works by simply crawling the spliced root package sets, so when you say generateSplicesForMkScope "qt6Packages" it grabs you something that has the stdenv attribute, even though it was not part of the call to mkScopeWithSplicing'.

So... the fix is somewhat nontrivial. We can either do something radical in generateSplicesForMkScope which attempts to filter out things that aren't in the original, somehow, or we can do that filter on the result of it.

@K900
Copy link
Contributor

K900 commented Mar 20, 2025

Oof. I guess we can just do this then.

@K900 K900 merged commit e51d7bd into NixOS:master Mar 20, 2025
27 checks passed
@rhelmot rhelmot deleted the qt6-stdenv branch March 20, 2025 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants