Skip to content

lib/nixos/eval-config.nix: Fix extraArgs#150045

Merged
roberth merged 1 commit intoNixOS:masterfrom
infinisil:fix-nixos-extraArgs
Dec 10, 2021
Merged

lib/nixos/eval-config.nix: Fix extraArgs#150045
roberth merged 1 commit intoNixOS:masterfrom
infinisil:fix-nixos-extraArgs

Conversation

@infinisil
Copy link
Member

Motivation for this change

Fixes a mistake in #148315 that
caused #148343 (comment)

Tested with this command:

nix-instantiate nixos/lib/eval-config.nix --arg modules '[ ({ x, ... }: { environment.etc.x.text = x; fileSystems."/".device = "d"; boot.loader.grub.device = "nodev"; }) ]' --arg extraArgs '{ x = "x"; }' -A config.system.build.toplevel

Which previously threw an error:

error: attribute 'x' missing, at /home/infinisil/src/nixpkgs/lib/modules.nix:385:28
(use '--show-trace' to show detailed location information)

But with this commit works, and gives the intended warning for extraArgs:

trace: warning: The extraArgs argument to eval-config.nix is deprecated. Please set config._module.args instead.
warning: you did not specify '--add-root'; the result might be removed by the garbage collector
/nix/store/hg5019xr1alcn76dbm38c17ci6x6pz3a-nixos-system-nixos-22.05pre-git.drv

Ping @roberth

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set 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/)
  • 22.05 Release Notes (or backporting 21.11 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
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@infinisil infinisil requested a review from nbp as a code owner December 10, 2021 11:58
@github-actions github-actions bot added the 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS label Dec 10, 2021
@roberth
Copy link
Member

roberth commented Dec 10, 2021

I remember checking this, but I must have checked the wrong file. :(
Thanks for fixing. Let's wait for ofborg before merging, to make sure it doesn't fail because of new warnings, warnings that aren't allowed.

@ofborg ofborg 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 Dec 10, 2021
@roberth roberth merged commit e817802 into NixOS:master Dec 10, 2021
@infinisil infinisil deleted the fix-nixos-extraArgs branch December 10, 2021 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 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.

2 participants