-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
References to pkgs
from ~/.config/nixpkgs/config.nix
produce infinite recursion
#246676
Comments
This also appears broken on Linux. $ nix run nixpkgs#nix-info -- -m
- system: `"x86_64-linux"`
- host os: `Linux 6.1.41, NixOS, 22.11 (Raccoon), 22.11.20230703.ea4c80b`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.11.1`
- nixpkgs: `/etc/nix/inputs/nixpkgs`
$ git rev-list a845397 -n 1
a845397040d1b85cec4ee41edb8598d8086c3d95
$ NIXPKGS_CONFIG=$(pwd)/../bug/config.nix nix-instantiate --eval --expr 'with import ./. {}; hello.version' --show-trace
error: infinite recursion encountered
at /home/reckenrode/nixpkgs/../bug/config.nix:4:30:
3| {
4| blocklistedLicenses = with pkgs.lib.licenses; [ agpl3Only agpl3Plus ];
| ^
5| }
… while evaluating anonymous lambda
at /home/reckenrode/nixpkgs/pkgs/stdenv/generic/check-meta.nix:41:40:
40| hasBlocklistedLicense = assert areLicenseListsValid; attrs:
41| hasLicense attrs && lib.lists.any (l: builtins.elem l blocklist) (lib.lists.toList attrs.meta.license);
| ^
42|
… from call site
# etc |
The nixos-22.11 channel works, so I’m using that as a known good commit to do a |
|
pkgs
from ~/.config/nixpkgs/config.nix
pkgs
from ~/.config/nixpkgs/config.nix
produce infinite recursion
I'm curious if anyone actually has any use for referencing anything other than |
Describe the bug
When using
~/.config/nixpkgs/config.nix
to configure nixpkgs, this file may optionally be a function that takes a single{ pkgs }:
parameter. This is necessary when adding configuration forblocklistedLicenses
in order to reference the licenses in question. Example usage:As of #240433 (darwin.stdenv: Darwin stdenv rework), the reference to
pkgs
within this file produces an infinite recursion error:Steps To Reproduce
Steps to reproduce the behavior:
~/.config/nixpkgs/config.nix
contains the contents listed above and that there is noNIXPKGS_CONFIG
env var (or setNIXPKGS_CONFIG
to the path of a file containing the above)nix-instantiate --eval --expr 'with import ./. {}; hello.version'
(if from a nixpkgs checkout, or import<nixpkgs>
if appropriate).Expected behavior
This should run successfully (in this case, printing the version of the
hello
package).Additional context
Merely doing something like
blocklistedLicenses = assert builtins.isAttrs pkgs; [];
is sufficient to cause this issue. Sticking this in some of the other config values (likeallowUnfree
) doesn't cause a problem, though I didn't test all of them. Looking at the full stack trace I think it's because it's trying to test the validity of../../build-support/cc-wrapper
during bootstrap, so it's likely just the allowlisted/blocklisted licenses that will end up evaluated here.I really wish the config here was given
{ lib }
instead, but that's a backwards-incompatible change.Notify maintainers
Folks involved in the relevant PR: @reckenrode @viraptor @veprbl @emilazy @Atemu @tjni @willcohen @siraben @uri-canva
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.The text was updated successfully, but these errors were encountered: