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

Infinite recursion after updating to 17.03 #24170

Closed
wizeman opened this issue Mar 21, 2017 · 7 comments · Fixed by #24610
Closed

Infinite recursion after updating to 17.03 #24170

wizeman opened this issue Mar 21, 2017 · 7 comments · Fixed by #24610

Comments

@wizeman
Copy link
Member

wizeman commented Mar 21, 2017

Issue description

When trying to update to NixOS 17.03, I am getting an infinite recursion while evaluating the configuration of my Raspberry Pi machine:

error: while evaluating the attribute ‘keys’ at /backup/nix/nixpkgs/lib/attrsets.nix:199:44:
while evaluating anonymous function at /backup/nix/nixpkgs/lib/options.nix:117:41, called from /backup/nix/nixpkgs/lib/attrsets.nix:199:52:
while evaluating ‘scrubOptionValue’ at /backup/nix/nixpkgs/lib/options.nix:113:22, called from /backup/nix/nixpkgs/lib/options.nix:117:44:
while evaluating ‘isDerivation’ at /backup/nix/nixpkgs/lib/attrsets.nix:295:18, called from /backup/nix/nixpkgs/lib/options.nix:114:8:
while evaluating the attribute ‘keys’ at /nixdev/nixpkgs/lib/attrsets.nix:199:44:
while evaluating anonymous function at /nixdev/nixpkgs/lib/modules.nix:75:45, called from /nixdev/nixpkgs/lib/attrsets.nix:199:52:
while evaluating the attribute ‘value’ at /nixdev/nixpkgs/lib/modules.nix:300:9:
while evaluating the option `deployment.keys':
while evaluating the attribute ‘isDefined’ at /nixdev/nixpkgs/lib/modules.nix:332:5:
while evaluating ‘filterOverrides’ at /nixdev/nixpkgs/lib/modules.nix:407:21, called from /nixdev/nixpkgs/lib/modules.nix:316:18:
while evaluating ‘concatMap’ at /nixdev/nixpkgs/lib/lists.nix:79:18, called from /nixdev/nixpkgs/lib/modules.nix:413:8:
while evaluating ‘concatMap’ at /nixdev/nixpkgs/lib/lists.nix:79:18, called from /nixdev/nixpkgs/lib/modules.nix:311:17:
while evaluating anonymous function at /nixdev/nixpkgs/lib/modules.nix:311:28, called from undefined position:
while evaluating ‘dischargeProperties’ at /nixdev/nixpkgs/lib/modules.nix:374:25, called from /nixdev/nixpkgs/lib/modules.nix:312:62:
while evaluating the attribute ‘value’ at /nixdev/nixpkgs/lib/modules.nix:204:48:
while evaluating the attribute ‘config.keys’ at /nix/store/bkkxf39jic9z29s9irh7z1inx56vmgxz-nixops-1.5/share/nix/nixops/auto-luks.nix:134:5:
while evaluating the module argument `utils' in "/nix/store/bkkxf39jic9z29s9irh7z1inx56vmgxz-nixops-1.5/share/nix/nixops/auto-luks.nix":
while evaluating the attribute ‘_module.args.utils’ at /nixdev/nixpkgs/lib/attrsets.nix:199:44:
while evaluating anonymous function at /nixdev/nixpkgs/lib/modules.nix:75:45, called from /nixdev/nixpkgs/lib/attrsets.nix:199:52:
while evaluating the attribute ‘value’ at /nixdev/nixpkgs/lib/modules.nix:300:9:
while evaluating the option `_module.args':
while evaluating the attribute ‘mergedValue’ at /nixdev/nixpkgs/lib/modules.nix:327:5:
while evaluating anonymous function at /nixdev/nixpkgs/lib/modules.nix:327:32, called from /nixdev/nixpkgs/lib/modules.nix:327:19:
while evaluating ‘merge’ at /nixdev/nixpkgs/lib/types.nix:201:20, called from /nixdev/nixpkgs/lib/modules.nix:330:8:
while evaluating ‘mapAttrs’ at /nixdev/nixpkgs/lib/attrsets.nix:198:17, called from /nixdev/nixpkgs/lib/types.nix:202:9:
while evaluating ‘filterAttrs’ at /nixdev/nixpkgs/lib/attrsets.nix:115:23, called from /nixdev/nixpkgs/lib/types.nix:202:35:
while evaluating ‘concatMap’ at /nixdev/nixpkgs/lib/lists.nix:79:18, called from /nixdev/nixpkgs/lib/attrsets.nix:116:18:
while evaluating anonymous function at /nixdev/nixpkgs/lib/attrsets.nix:116:29, called from undefined position:
while evaluating anonymous function at /nixdev/nixpkgs/lib/types.nix:202:51, called from /nixdev/nixpkgs/lib/attrsets.nix:116:62:
while evaluating the attribute ‘pkgs’ at /nixdev/nixpkgs/lib/attrsets.nix:334:7:
while evaluating anonymous function at /nixdev/nixpkgs/lib/types.nix:202:86, called from /nixdev/nixpkgs/lib/attrsets.nix:334:15:
while evaluating the attribute ‘optionalValue’ at /nixdev/nixpkgs/lib/modules.nix:334:5:
while evaluating ‘filterOverrides’ at /nixdev/nixpkgs/lib/modules.nix:407:21, called from /nixdev/nixpkgs/lib/modules.nix:316:18:
while evaluating ‘concatMap’ at /nixdev/nixpkgs/lib/lists.nix:79:18, called from /nixdev/nixpkgs/lib/modules.nix:413:8:
while evaluating ‘concatMap’ at /nixdev/nixpkgs/lib/lists.nix:79:18, called from /nixdev/nixpkgs/lib/modules.nix:311:17:
while evaluating anonymous function at /nixdev/nixpkgs/lib/modules.nix:311:28, called from undefined position:
while evaluating ‘dischargeProperties’ at /nixdev/nixpkgs/lib/modules.nix:374:25, called from /nixdev/nixpkgs/lib/modules.nix:312:62:
while evaluating the attribute ‘value’ at /nixdev/nixpkgs/lib/types.nix:207:55:
while evaluating the attribute ‘pkgs’ at /nixdev/nixpkgs/nixos/modules/misc/nixpkgs.nix:100:5:
while evaluating anonymous function at /backup/nix/nixpkgs/pkgs/top-level/impure.nix:15:1, called from /nixdev/nixpkgs/nixos/modules/misc/nixpkgs.nix:100:25:
while evaluating anonymous function at /backup/nix/nixpkgs/pkgs/top-level/default.nix:20:1, called from /backup/nix/nixpkgs/pkgs/top-level/impure.nix:63:1:
while evaluating anonymous function at /backup/nix/nixpkgs/pkgs/stdenv/booter.nix:42:1, called from /backup/nix/nixpkgs/pkgs/top-level/default.nix:93:10:
while evaluating ‘fold’ at /backup/nix/nixpkgs/lib/lists.nix:29:19, called from /backup/nix/nixpkgs/pkgs/stdenv/booter.nix:73:4:
while evaluating ‘fold'’ at /backup/nix/nixpkgs/lib/lists.nix:32:15, called from /backup/nix/nixpkgs/lib/lists.nix:36:8:
while evaluating ‘folder’ at /backup/nix/nixpkgs/pkgs/stdenv/booter.nix:58:22, called from /backup/nix/nixpkgs/lib/lists.nix:35:14:
while evaluating ‘allPackages’ at /backup/nix/nixpkgs/pkgs/top-level/default.nix:83:17, called from /backup/nix/nixpkgs/pkgs/stdenv/booter.nix:69:10:
while evaluating anonymous function at /backup/nix/nixpkgs/pkgs/top-level/stage.nix:12:1, called from /backup/nix/nixpkgs/pkgs/top-level/default.nix:83:26:
while evaluating ‘fix’ at /backup/nix/nixpkgs/lib/trivial.nix:29:9, called from /backup/nix/nixpkgs/pkgs/top-level/stage.nix:150:3:
while evaluating ‘extends’ at /backup/nix/nixpkgs/lib/trivial.nix:54:24, called from /backup/nix/nixpkgs/lib/trivial.nix:29:20:
while evaluating ‘extends’ at /backup/nix/nixpkgs/lib/trivial.nix:54:24, called from /backup/nix/nixpkgs/lib/trivial.nix:54:42:
while evaluating ‘stdenvOverrides’ at /backup/nix/nixpkgs/pkgs/top-level/stage.nix:121:27, called from /backup/nix/nixpkgs/lib/trivial.nix:54:67:
while evaluating the attribute ‘stdenv.overrides’ at /backup/nix/nixpkgs/pkgs/top-level/stage.nix:100:5:
while evaluating ‘optionalAttrs’ at /backup/nix/nixpkgs/lib/attrsets.nix:321:25, called from /backup/nix/nixpkgs/pkgs/top-level/stage.nix:102:10:
while evaluating the module argument `pkgs' in "/backup/root/src/wizynet/config-tvrasp.nix":
while evaluating the attribute ‘_module.args.pkgs’ at /nixdev/nixpkgs/lib/attrsets.nix:199:44:
infinite recursion encountered, at undefined position
error: evaluation of the deployment specification failed

Steps to reproduce

The problem appears to be related to the following highlighted portion of my configuration.nix, since the infinite recursion disappears if I remove this option:

   nixpkgs = {
+    config = {
+      platform = pkgs.platforms.raspberrypi2;
+    };
     system = "armv7l-linux";
  };

It appears that at least one other user may have ran into this issue as well, according to #22014 (comment)

@Ericson2314: do you think this problem may have been introduced with #22107?

Technical details

  • System: NixOS 17.03
  • Nixpkgs version: 5e4b43d
@Ericson2314
Copy link
Member

Ericson2314 commented Mar 21, 2017

@wizeman Yes that is probably my fault. As far as I can see there is no good way to make this work as is, sorry :/. While pkgs.platform doesn't depend on anything else in pkgs, pkgs depends on platform, and Nix can't see through all the bootstrapping we do and fixed points we make to realize there actually is no cycle.

The proper solution then is to move top-level/platforms.nix into the lib. In fact, a month-old branch of mine, https://github.com/Ericson2314/nixpkgs/tree/platform-normalization does exactly that, but then also some other cleanup which is WIP. Perhaps I should make the move first, and do the refactor on top.

@wizeman
Copy link
Member Author

wizeman commented Apr 3, 2017

This should really be fixed, because I think most NixOS configurations on ARM machines contain the line above, so when people upgrade to NixOS 17.03 they will run into this problem (and may not be able to figure out what's going on).

In the meantime, in case other people run into this issue, a workaround is to change the following line:

platform = pkgs.platforms.raspberrypi2;

... into:

platform = (import <nixpkgs/pkgs/top-level/platforms.nix>).raspberrypi2;

@eqyiel
Copy link
Contributor

eqyiel commented Jul 2, 2017

I'm seeing this issue after #24610, but now you have to import from nixpkgs/lib/systems/platforms.nix instead.

For future humans, the workaround now looks like this:

nixpkgs.config.platform = (import <nixpkgs/pkgs/top-level/platforms.nix>).raspberrypi2;

@Ericson2314
Copy link
Member

Ericson2314 commented Jul 2, 2017

@eqyiel I think you copied the old one by mistakte? Now the workaround would be

{
  nixpkgs.config.platform = (import <nixpkgs/lib/systems/platforms.nix>).raspberrypi2;
} # N.B. wrote `examples.nix` before, which is different

But that shouldn't be necessary:

{ lib, ... }:

{
  nixpkgs.config.platform = lib.systems.examples.raspberrypi2;
}

should work.

@eqyiel
Copy link
Contributor

eqyiel commented Jul 2, 2017

@Ericson2314 you're right, I mean to say that the workaround is like this:

nixpkgs.config.platform = (import <nixpkgs/lib/systems/platforms.nix>).raspberrypi2;

I'm not really sure what I'm doing though, I just started with the configuration example here. I'll try your suggestion as soon as I can and see what happens.

Edit: linked to the wrong wiki, configuration example is here

@Ericson2314
Copy link
Member

Ah yes, it's still platforms.nix. examples.nix is something else.

@eqyiel
Copy link
Contributor

eqyiel commented Jul 4, 2017

Yep, you can now just use

nixpkgs.config.platform = lib.systems.platforms.raspberrypi2;

I'll see if I can update the wiki.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants