Skip to content

lib.derivations: avoid common double-warn with warnOnInstantiate#414606

Merged
hsjobeki merged 1 commit intoNixOS:masterfrom
pbsds:feat-no-double-warn-1749250238
Jun 19, 2025
Merged

lib.derivations: avoid common double-warn with warnOnInstantiate#414606
hsjobeki merged 1 commit intoNixOS:masterfrom
pbsds:feat-no-double-warn-1749250238

Conversation

@pbsds
Copy link
Member

@pbsds pbsds commented Jun 6, 2025

Before:

$ nix-build . -A opensycl
trace: evaluation warning: 'opensycl' has been renamed to 'adaptivecpp'
trace: evaluation warning: 'opensycl' has been renamed to 'adaptivecpp'
/nix/store/8g0lfv82s0sprmqgfj146ggkb7bn3rm6-adaptivecpp-25.02.0

$ nix-instantiate . -A opensycl
trace: evaluation warning: 'opensycl' has been renamed to 'adaptivecpp'
trace: evaluation warning: 'opensycl' has been renamed to 'adaptivecpp'
warning: you did not specify '--add-root'; the result might be removed by the garbage collector
/nix/store/b8q5xp94s4n7zfn7as5a9xjvylh6y3pi-adaptivecpp-25.02.0.drv

After:

$ nix-build . -A opensycl
trace: evaluation warning: 'opensycl' has been renamed to 'adaptivecpp'
/nix/store/8g0lfv82s0sprmqgfj146ggkb7bn3rm6-adaptivecpp-25.02.0

$ nix-instantiate . -A opensycl
trace: evaluation warning: 'opensycl' has been renamed to 'adaptivecpp'
warning: you did not specify '--add-root'; the result might be removed by the garbage collector
/nix/store/b8q5xp94s4n7zfn7as5a9xjvylh6y3pi-adaptivecpp-25.02.0.drv

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/)
  • Nixpkgs 25.11 Release Notes (or backporting 24.11 and 25.05 Nixpkgs Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
  • NixOS 25.11 Release Notes (or backporting 24.11 and 25.05 NixOS Release notes)
    • (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.

Before:

    $ nix-build . -A opensycl
    trace: evaluation warning: 'opensycl' has been renamed to 'adaptivecpp'
    trace: evaluation warning: 'opensycl' has been renamed to 'adaptivecpp'
    /nix/store/8g0lfv82s0sprmqgfj146ggkb7bn3rm6-adaptivecpp-25.02.0

    $ nix-instantiate . -A opensycl
    trace: evaluation warning: 'opensycl' has been renamed to 'adaptivecpp'
    trace: evaluation warning: 'opensycl' has been renamed to 'adaptivecpp'
    warning: you did not specify '--add-root'; the result might be removed by the garbage collector
    /nix/store/b8q5xp94s4n7zfn7as5a9xjvylh6y3pi-adaptivecpp-25.02.0.drv

After:

    $ nix-build . -A opensycl
    trace: evaluation warning: 'opensycl' has been renamed to 'adaptivecpp'
    /nix/store/8g0lfv82s0sprmqgfj146ggkb7bn3rm6-adaptivecpp-25.02.0

    $ nix-instantiate . -A opensycl
    trace: evaluation warning: 'opensycl' has been renamed to 'adaptivecpp'
    warning: you did not specify '--add-root'; the result might be removed by the garbage collector
    /nix/store/b8q5xp94s4n7zfn7as5a9xjvylh6y3pi-adaptivecpp-25.02.0.drv
@github-actions github-actions bot added the 6.topic: lib The Nixpkgs function library label Jun 6, 2025
@nix-owners nix-owners bot requested review from hsjobeki and infinisil June 6, 2025 22:57
@github-actions github-actions bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Jun 6, 2025
@pbsds
Copy link
Member Author

pbsds commented Jun 7, 2025

I also want to exclude .system to make nix-env ... -qaP go from 3 to 1 warnings per package with warnOnInstantiate, but I need some consensus before adding it to the proposed patch

Copy link
Contributor

@hsjobeki hsjobeki left a comment

Choose a reason for hiding this comment

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

Approving, neat fix.

I think this needs a little more explaining why the double warning happens in the first place.
In order to understand how the fix works:

nix-build / nix-instantiate commands require both drvPath and outputName

drvPath ->evaluation warning: 'opensycl' has been renamed to 'adaptivecpp'
outputName -> evaluation warning: 'opensycl' has been renamed to 'adaptivecpp'

Excluding outputName from the warning is fine i think.

And all other attributes still contain the warning.

Skimming through the nix manual i didn't find any commands that would only interact with ignored attributes (i.e. outputName) Which would lead to non-warning behavior. So i think this good to go.

@hsjobeki hsjobeki merged commit 982c74a into NixOS:master Jun 19, 2025
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: lib The Nixpkgs function library 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants