nixpkgs: pass lib to config function#457120
Conversation
|
Tagging @infinisil and @ConnorBaker: this is a completely different -- and somewhat more scary -- fix for #456994 than the one @ConnorBaker proposed in #457038. I expect this change is likely to break even more folks' configurations, e.g. if they've defined a config function like |
ad6d64c to
4faedbf
Compare
Do you know where that happens specifically? I've got a suspicion that the infinite recursion is caused by the fact that attribute sets are strict in their keys and somewhere along the way during bootstrapping the presence or absence of a value depends on something that it shouldn't. |
I think it's more fundamental and difficult to fix than that :( Evaluating nixpkgs/pkgs/top-level/default.nix Lines 169 to 182 in 08dacfc Based on the nixpkgs/pkgs/stdenv/linux/default.nix Line 380 in 08dacfc I agree evaluating the keys in I have the impression the reason NixOS modules get passed |
|
4faedbf to
ea9052a
Compare
|
I've just updated the PR to document an alternative configuration change in the release notes that will work with both 25.05 and 25.11, with thanks to @emilazy for prompting me to think about how to make that possible. |
This reverts commit f5deefd. See: - NixOS#437723 (introduced commit) - NixOS#456994 (reported breakage) - NixOS#457038 (attempted fix, closed in favor of this revert) - NixOS#457120 (fix which would require more breaking changes)
ea9052a to
17dd85b
Compare
|
I'm going to mark this as a draft for now. I think it's probably a sensible change even now the proximate need for it has been backed out (#457338), but not for 25.11. |
|
And re-opening now this can be merged into (presumably) master for 26.05. |
17dd85b to
0d9e216
Compare
|
...except now with updated documentation for targeting 26.05. |
|
@ConnorBaker At #456994 (comment) you said you'd like to see this PR merged. I think all the feedback has now been merged, and I'd rather get it in before there can be any merge conflicts. Are you able and willing to press the magic buttons? |
Nixpkgs config, for defining things like which licenses are permitted, can either be an attrset or a function that is passed a `pkgs` argument. Evaluating that `pkgs` argument requires computing the Nixpkgs fixpoint, which requires checking whether the derivations used in the Nixpkgs bootstrap have valid licenses. This works provided nothing tries to use Nixpkgs functions to validate or merge anything included in the configuration. f5deefd (config: add and document {allow,block}listedLicenses, 2025-08-31), in NixOS#437723, added type checking and merging to the lists of permitted/forbidden licenses. That resulted in a recursion loop if a list of licenses included, say, `pkgs.lib.licenses.bsd0`. To allow licenses to be specified from Nixpkgs' library, pass `lib` as well as `pkgs` to any config function. Computing `lib` doesn't require working out the full Nixpkgs fixpoint. The change in NixOS#437723 will still break things for some people, but it at least provides a sensible route to getting the config working again. Fixes NixOS#456994.
0d9e216 to
8e94561
Compare
|
Apologies for the delay! |
Nixpkgs config, for defining things like which licenses are permitted, can either be an attrset or a function that is passed a
pkgsargument. Evaluating thatpkgsargument requires computing the Nixpkgs fixpoint, which requires checking whether the derivations used in the Nixpkgs bootstrap have valid licenses. This works provided nothing tries to use Nixpkgs functions to validate or merge anything included in the configuration.f5deefd (config: add and document {allow,block}listedLicenses, 2025-08-31), in #437723, added type checking and merging to the lists of permitted/forbidden licenses. That resulted in a recursion loop if a list of licenses included, say,
pkgs.lib.licenses.bsd0.To allow licenses to be specified from Nixpkgs' library, pass
libas well aspkgsto any config function. Computinglibdoesn't require working out the full Nixpkgs fixpoint. The change in #437723 will still break things for some people, but it at least provides a sensible route to getting the config working again.Fixes #456994.
Things done
nixpkgs-reviewon this PR. See nixpkgs-review usage.Add a 👍 reaction to pull requests you find important.