Skip to content

pkgsMusl, pkgsi686Linux, pkgsStatic: fix infinite recursion with overlays #58246

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

Merged

Conversation

danbst
Copy link
Contributor

@danbst danbst commented Mar 25, 2019

Consider example:

$ nix-instantiate ./nixos -A system --arg configuration '
    {
      boot.isContainer = true;
      nixpkgs.overlays = [ (self: super: {
        nix = self.pkgsStatic.nix;
      }) ];
    }'

When resolving package through overlays, we figure out that

  nix == self.pkgsStatic.nix
  =>
  nix == (import <nixpkgs> { inherit overlays; }).nix
  =>
  nix == (import <nixpkgs> { overlays = [(self: super: { nix = self.pkgsStatic.nix; })];}).nix

and we enter infinite recursion of nixpkgs evaluations.

The proper fix should terminate recursion by assigning self fixpoint
to inner custom package set. But I get infinite recursion somehow, so
I use super. It is less correct modulo deep custom overrides, but behaves
correctly for simple cases and doesn't OOM evaluator.

Fixes #57984

Verified

This commit was signed with the committer’s verified signature.
…lays

Consider example:

$ nix-instantiate ./nixos -A system --arg configuration '
    {
      boot.isContainer = true;
      nixpkgs.overlays = [ (self: super: {
        nix = self.pkgsStatic.nix;
      }) ];
    }'

When resolving package through overlays, we figure out that

  nix == self.pkgsStatic.nix
  =>
  nix == (import <nixpkgs> { inherit overlays; }).nix
  =>
  nix == (import <nixpkgs> { overlays = [(self: super: { nix = self.pkgsStatic.nix; })];}).nix

and we enter infinite recursion of nixpkgs evaluations.

The proper fix should terminate recursion by assigning self fixpoint
to inner custom package set. But I get infinite recursion somehow, so
I use `super`. It is less correct modulo deep custom overrides, but behaves
correctly for simple cases and doesn't OOM evaluator.

Fixes NixOS#57984
@GrahamcOfBorg GrahamcOfBorg 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 Mar 25, 2019
@matthewbauer matthewbauer merged commit 5f32434 into NixOS:master Mar 25, 2019
@matthewbauer
Copy link
Member

This should probably be backported to 18.09 and 19.03.

@Ericson2314
Copy link
Member

I feel like the need for this exposes a weakness in the current design, but it's fine for now.

@danbst
Copy link
Contributor Author

danbst commented Mar 26, 2019

@matthewbauer ok, I'll do it for 19.03, but also have to backport 83ae1ff

@danbst danbst deleted the infinite-recursion-otherPackageSets branch March 26, 2019 08:15
@oxij
Copy link
Member

oxij commented Mar 26, 2019 via email

@matthewbauer
Copy link
Member

@oxij Someone reproduced #57984 on 18.09 so I don't think that commit caused the issue.

@oxij
Copy link
Member

oxij commented Mar 26, 2019 via email

@danbst
Copy link
Contributor Author

danbst commented Mar 26, 2019

backported 19.03 e8dac0c and 3dedec4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

Building ISO takes excessive amounts of time+memory
5 participants