git.iko.soy/typeable/nixpkgs
on master help sign in
pkgsMusl, pkgsi686Linux, pkgsStatic: fix infinite recursion with overlays

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 https://github.com/NixOS/nixpkgs/issues/57984

commitf72903864d5e2be87bb532a516ee8d52c034a9fc authordanbst <abcz2.uprola@gmail.com> dateMon 25 Mar 2019, 10:51 (8 years ago) parent5699e8e
1 file changed+9
pkgs/top-level/stage.nix+9
pkgs/top-level/stage.nix+9
@@ -135,6 +135,9 @@ let
135135 # default GNU libc on Linux systems. Non-Linux systems are not
136136 # supported.
137137 pkgsMusl = if stdenv.hostPlatform.isLinux then nixpkgsFun {
138+ overlays = [ (self': super': {
139+ pkgsMusl = super';
140+ })] ++ overlays;
138141 ${if stdenv.hostPlatform == stdenv.buildPlatform
139142 then "localSystem" else "crossSystem"} = {
140143 parsed = stdenv.hostPlatform.parsed // {
@@ -151,6 +154,9 @@ let
151154 # All packages built for i686 Linux.
152155 # Used by wine, firefox with debugging version of Flash, ...
153156 pkgsi686Linux = if stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86 then nixpkgsFun {
157+ overlays = [ (self': super': {
158+ pkgsi686Linux = super';
159+ })] ++ overlays;
154160 ${if stdenv.hostPlatform == stdenv.buildPlatform
155161 then "localSystem" else "crossSystem"} = {
156162 parsed = stdenv.hostPlatform.parsed // {
@@ -176,6 +182,9 @@ let
176182 # Fully static packages.
177183 # Currently uses Musl on Linux (couldn’t get static glibc to work).
178184 pkgsStatic = nixpkgsFun ({
185+ overlays = [ (self': super': {
186+ pkgsStatic = super';
187+ })] ++ overlays;
179188 crossOverlays = [ (import ./static.nix) ];
180189 } // lib.optionalAttrs stdenv.hostPlatform.isLinux {
181190 crossSystem = {