Infinite recursion in nix-shell

When trying to create even a simple nix-shell, such as nix-shell -p lolcat I am receiving an infinite recursion error. The only info I could find that was related was people talking about overlays in configuration.nix possibly causing this. However, when I commented those out, rebuilt, and tried again nix-shell still crashed.

Any help would be appreciated. Here is the stack trace, I removed part of the recursion for size limits:

error:
       … while calling anonymous lambda

         at «string»:1:1:

            1| {...}@args: with import <nixpkgs> args; (pkgs.runCommandCC or pkgs.runCommand) "shell" { buildInputs = [ (lolcat) ]; } ""
             | ^

       … from call site

         at «string»:1:18:

            1| {...}@args: with import <nixpkgs> args; (pkgs.runCommandCC or pkgs.runCommand) "shell" { buildInputs = [ (lolcat) ]; } ""
             |                  ^

       … while calling anonymous lambda

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/top-level/impure.nix:14:1:

           13|
           14| { # We put legacy `system` into `localSystem`, if `localSystem` was not passed.
             | ^
           15|   # If neither is passed, assume we are building packages on the current

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/top-level/impure.nix:87:1:

           86|
           87| import ./. (builtins.removeAttrs args [ "system" ] // {
             | ^
           88|   inherit config overlays localSystem;

       … while calling anonymous lambda

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/top-level/default.nix:19:1:

           18|
           19| { # The system packages will be built on. See the manual for the
             | ^
           20|   # subtle division of labor between these two `*System`s and the three

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/top-level/default.nix:144:4:

          143|
          144| in checked pkgs
             |    ^
          145|

       … while calling anonymous lambda

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/top-level/default.nix:58:108:

           57|     throwIfNot (lib.isList crossOverlays) "The crossOverlays argument to nixpkgs must be a list."
           58|     lib.foldr (x: throwIfNot (lib.isFunction x) "All crossOverlays passed to nixpkgs must be functions.") (r: r) crossOverlays
             |                                                                                                            ^
           59|     ;

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/top-level/default.nix:142:10:

          141|
          142|   pkgs = boot stages;
             |          ^
          143|

       … while calling anonymous lambda

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:42:1:

           41| # other words, this does a foldr not foldl.
           42| stageFuns: let
             | ^
           43|

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:142:4:

          141|
          142| in dfold folder postStage (_: {}) withAllowCustomOverrides
             |    ^
          143|

       … while calling 'dfold'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:60:27:

           59|   */
           60|   dfold = op: lnul: rnul: list:
             |                           ^
           61|     let

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:72:13:

           71|       lapp = lnul cur;
           72|       cur = go lapp 0;
             |             ^
           73|     in cur;

       … while calling 'go'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:63:18:

           62|       len = builtins.length list;
           63|       go = pred: n:
             |                  ^
           64|         if n == len

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:68:18:

           67|           # Note the cycle -- call-by-need ensures finite fold.
           68|           cur  = op pred (builtins.elemAt list n) succ;
             |                  ^
           69|           succ = go cur (n + 1);

       … while calling 'folder'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:89:33:

           88|   # debugging purposes.
           89|   folder = nextStage: stageFun: prevStage: let
             |                                 ^
           90|     args = stageFun prevStage;

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:90:12:

           89|   folder = nextStage: stageFun: prevStage: let
           90|     args = stageFun prevStage;
             |            ^
           91|     args' = args // {

       … while calling anonymous lambda

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:79:23:

           78|   withAllowCustomOverrides = lib.lists.imap1
           79|     (index: stageFun: prevStage:
             |                       ^
           80|       # So true by default for only the first element because one

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:84:11:

           83|       { allowCustomOverrides = index == 1; }
           84|       // (stageFun prevStage))
             |           ^
           85|     (lib.lists.reverseList stageFuns);

       … while calling anonymous lambda

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:689:4:

          688|   # This "no-op" stage is just a place to put the assertions about stage5.
          689|   (prevStage:
             |    ^
          690|     # previous stage5 stdenv; see stage3 comment regarding gcc,

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:692:12:

          691|     # which applies here as well.
          692|     assert isBuiltByNixpkgsCompiler prevStage.binutils-unwrapped;
             |            ^
          693|     assert isBuiltByNixpkgsCompiler prevStage.${localSystem.libc};

       … while calling 'isBuiltByNixpkgsCompiler'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:108:5:

          107|   isBuiltByNixpkgsCompiler =
          108|     pkg: isFromNixpkgs pkg && isFromNixpkgs pkg.stdenv.cc.cc;
             |     ^
          109|   isBuiltByBootstrapFilesCompiler =

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:108:10:

          107|   isBuiltByNixpkgsCompiler =
          108|     pkg: isFromNixpkgs pkg && isFromNixpkgs pkg.stdenv.cc.cc;
             |          ^
          109|   isBuiltByBootstrapFilesCompiler =

       … while calling 'isFromNixpkgs'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:104:19:

          103|
          104|   isFromNixpkgs = pkg: !(isFromBootstrapFiles pkg);
             |                   ^
          105|   isFromBootstrapFiles =

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:104:26:

          103|
          104|   isFromNixpkgs = pkg: !(isFromBootstrapFiles pkg);
             |                          ^
          105|   isFromBootstrapFiles =

       … while calling 'isFromBootstrapFiles'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:106:5:

          105|   isFromBootstrapFiles =
          106|     pkg: pkg.passthru.isFromBootstrapFiles or false;
             |     ^
          107|   isBuiltByNixpkgsCompiler =

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:69:18:

           68|           cur  = op pred (builtins.elemAt list n) succ;
           69|           succ = go cur (n + 1);
             |                  ^
           70|         in cur;

       … while calling 'go'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:63:18:

           62|       len = builtins.length list;
           63|       go = pred: n:
             |                  ^
           64|         if n == len

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:68:18:

           67|           # Note the cycle -- call-by-need ensures finite fold.
           68|           cur  = op pred (builtins.elemAt list n) succ;
             |                  ^
           69|           succ = go cur (n + 1);

       … while calling 'folder'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:89:33:

           88|   # debugging purposes.
           89|   folder = nextStage: stageFun: prevStage: let
             |                                 ^
           90|     args = stageFun prevStage;

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:90:12:

           89|   folder = nextStage: stageFun: prevStage: let
           90|     args = stageFun prevStage;
             |            ^
           91|     args' = args // {

       … while calling anonymous lambda

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:79:23:

           78|   withAllowCustomOverrides = lib.lists.imap1
           79|     (index: stageFun: prevStage:
             |                       ^
           80|       # So true by default for only the first element because one

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:84:11:

           83|       { allowCustomOverrides = index == 1; }
           84|       // (stageFun prevStage))
             |           ^
           85|     (lib.lists.reverseList stageFuns);

       … while calling anonymous lambda

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:595:4:

          594|   #
          595|   (prevStage:
             |    ^
          596|     # previous stage4 stdenv; see stage3 comment regarding gcc,

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:598:12:

          597|     # which applies here as well.
          598|     assert isBuiltByNixpkgsCompiler prevStage.binutils-unwrapped;
             |            ^
          599|     assert isBuiltByNixpkgsCompiler prevStage.${localSystem.libc};

       … while calling 'isBuiltByNixpkgsCompiler'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:108:5:

          107|   isBuiltByNixpkgsCompiler =
          108|     pkg: isFromNixpkgs pkg && isFromNixpkgs pkg.stdenv.cc.cc;
             |     ^
          109|   isBuiltByBootstrapFilesCompiler =

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:108:10:

          107|   isBuiltByNixpkgsCompiler =
          108|     pkg: isFromNixpkgs pkg && isFromNixpkgs pkg.stdenv.cc.cc;
             |          ^
          109|   isBuiltByBootstrapFilesCompiler =

       … while calling 'isFromNixpkgs'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:104:19:

          103|
          104|   isFromNixpkgs = pkg: !(isFromBootstrapFiles pkg);
             |                   ^
          105|   isFromBootstrapFiles =

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:104:26:

          103|
          104|   isFromNixpkgs = pkg: !(isFromBootstrapFiles pkg);
             |                          ^
          105|   isFromBootstrapFiles =

       … while calling 'isFromBootstrapFiles'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:106:5:

          105|   isFromBootstrapFiles =
          106|     pkg: pkg.passthru.isFromBootstrapFiles or false;
             |     ^
          107|   isBuiltByNixpkgsCompiler =

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:69:18:

           68|           cur  = op pred (builtins.elemAt list n) succ;
           69|           succ = go cur (n + 1);
             |                  ^
           70|         in cur;

       … while calling 'go'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:63:18:

           62|       len = builtins.length list;
           63|       go = pred: n:
             |                  ^
           64|         if n == len

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:68:18:

           67|           # Note the cycle -- call-by-need ensures finite fold.
           68|           cur  = op pred (builtins.elemAt list n) succ;
             |                  ^
           69|           succ = go cur (n + 1);

       … while calling 'folder'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:89:33:

           88|   # debugging purposes.
           89|   folder = nextStage: stageFun: prevStage: let
             |                                 ^
           90|     args = stageFun prevStage;

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:90:12:

           89|   folder = nextStage: stageFun: prevStage: let
           90|     args = stageFun prevStage;
             |            ^
           91|     args' = args // {

       … while calling anonymous lambda

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:79:23:

           78|   withAllowCustomOverrides = lib.lists.imap1
           79|     (index: stageFun: prevStage:
             |                       ^
           80|       # So true by default for only the first element because one

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:84:11:

           83|       { allowCustomOverrides = index == 1; }
           84|       // (stageFun prevStage))
             |           ^
           85|     (lib.lists.reverseList stageFuns);

       … while calling anonymous lambda

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:539:4:

          538|   #
          539|   (prevStage:
             |    ^
          540|     # previous stage3 stdenv:

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:541:12:

          540|     # previous stage3 stdenv:
          541|     assert isBuiltByNixpkgsCompiler prevStage.binutils-unwrapped;
             |            ^
          542|     assert isBuiltByNixpkgsCompiler prevStage.${localSystem.libc};

       … while calling 'isBuiltByNixpkgsCompiler'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:108:5:

          107|   isBuiltByNixpkgsCompiler =
          108|     pkg: isFromNixpkgs pkg && isFromNixpkgs pkg.stdenv.cc.cc;
             |     ^
          109|   isBuiltByBootstrapFilesCompiler =

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:108:10:

          107|   isBuiltByNixpkgsCompiler =
          108|     pkg: isFromNixpkgs pkg && isFromNixpkgs pkg.stdenv.cc.cc;
             |          ^
          109|   isBuiltByBootstrapFilesCompiler =

       … while calling 'isFromNixpkgs'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:104:19:

          103|
          104|   isFromNixpkgs = pkg: !(isFromBootstrapFiles pkg);
             |                   ^
          105|   isFromBootstrapFiles =

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:104:26:

          103|
          104|   isFromNixpkgs = pkg: !(isFromBootstrapFiles pkg);
             |                          ^
          105|   isFromBootstrapFiles =

       … while calling 'isFromBootstrapFiles'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:106:5:

          105|   isFromBootstrapFiles =
          106|     pkg: pkg.passthru.isFromBootstrapFiles or false;
             |     ^
          107|   isBuiltByNixpkgsCompiler =

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:69:18:

           68|           cur  = op pred (builtins.elemAt list n) succ;
           69|           succ = go cur (n + 1);
             |                  ^
           70|         in cur;

       … while calling 'go'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:63:18:

           62|       len = builtins.length list;
           63|       go = pred: n:
             |                  ^
           64|         if n == len

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:68:18:

           67|           # Note the cycle -- call-by-need ensures finite fold.
           68|           cur  = op pred (builtins.elemAt list n) succ;
             |                  ^
           69|           succ = go cur (n + 1);

       … while calling 'folder'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:89:33:

           88|   # debugging purposes.
           89|   folder = nextStage: stageFun: prevStage: let
             |                                 ^
           90|     args = stageFun prevStage;

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:90:12:

           89|   folder = nextStage: stageFun: prevStage: let
           90|     args = stageFun prevStage;
             |            ^
           91|     args' = args // {

       … while calling anonymous lambda

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:79:23:

           78|   withAllowCustomOverrides = lib.lists.imap1
           79|     (index: stageFun: prevStage:
             |                       ^
           80|       # So true by default for only the first element because one

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:84:11:

           83|       { allowCustomOverrides = index == 1; }
           84|       // (stageFun prevStage))
             |           ^
           85|     (lib.lists.reverseList stageFuns);

       … while calling anonymous lambda

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:497:4:

          496|   # binutils and rest of the bootstrap tools, including GCC.
          497|   (prevStage:
             |    ^
          498|     # previous stage2 stdenv:

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:499:19:

          498|     # previous stage2 stdenv:
          499|     assert        isBuiltByNixpkgsCompiler prevStage.binutils-unwrapped;
             |                   ^
          500|     assert        isBuiltByNixpkgsCompiler prevStage.${localSystem.libc};

       … while calling 'isBuiltByNixpkgsCompiler'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:108:5:

          107|   isBuiltByNixpkgsCompiler =
          108|     pkg: isFromNixpkgs pkg && isFromNixpkgs pkg.stdenv.cc.cc;
             |     ^
          109|   isBuiltByBootstrapFilesCompiler =

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:108:10:

          107|   isBuiltByNixpkgsCompiler =
          108|     pkg: isFromNixpkgs pkg && isFromNixpkgs pkg.stdenv.cc.cc;
             |          ^
          109|   isBuiltByBootstrapFilesCompiler =

       … while calling 'isFromNixpkgs'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:104:19:

          103|
          104|   isFromNixpkgs = pkg: !(isFromBootstrapFiles pkg);
             |                   ^
          105|   isFromBootstrapFiles =

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:104:26:

          103|
          104|   isFromNixpkgs = pkg: !(isFromBootstrapFiles pkg);
             |                          ^
          105|   isFromBootstrapFiles =

       … while calling 'isFromBootstrapFiles'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:106:5:

          105|   isFromBootstrapFiles =
          106|     pkg: pkg.passthru.isFromBootstrapFiles or false;
             |     ^
          107|   isBuiltByNixpkgsCompiler =

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:69:18:

           68|           cur  = op pred (builtins.elemAt list n) succ;
           69|           succ = go cur (n + 1);
             |                  ^
           70|         in cur;

       … while calling 'go'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:63:18:

           62|       len = builtins.length list;
           63|       go = pred: n:
             |                  ^
           64|         if n == len

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:68:18:

           67|           # Note the cycle -- call-by-need ensures finite fold.
           68|           cur  = op pred (builtins.elemAt list n) succ;
             |                  ^
           69|           succ = go cur (n + 1);

       … while calling 'folder'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:89:33:

           88|   # debugging purposes.
           89|   folder = nextStage: stageFun: prevStage: let
             |                                 ^
           90|     args = stageFun prevStage;

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:90:12:

           89|   folder = nextStage: stageFun: prevStage: let
           90|     args = stageFun prevStage;
             |            ^
           91|     args' = args // {

       … while calling anonymous lambda

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:79:23:

           78|   withAllowCustomOverrides = lib.lists.imap1
           79|     (index: stageFun: prevStage:
             |                       ^
           80|       # So true by default for only the first element because one

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:84:11:

           83|       { allowCustomOverrides = index == 1; }
           84|       // (stageFun prevStage))
             |           ^
           85|     (lib.lists.reverseList stageFuns);

       … while calling anonymous lambda

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:411:4:

          410|   #
          411|   (prevStage:
             |    ^
          412|     # previous stage1 stdenv:

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:413:12:

          412|     # previous stage1 stdenv:
          413|     assert isBuiltByBootstrapFilesCompiler prevStage.binutils-unwrapped;
             |            ^
          414|     assert            isFromBootstrapFiles prevStage."${localSystem.libc}";

       … while calling 'isBuiltByBootstrapFilesCompiler'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:110:5:

          109|   isBuiltByBootstrapFilesCompiler =
          110|     pkg: isFromNixpkgs pkg && isFromBootstrapFiles pkg.stdenv.cc.cc;
             |     ^
          111|

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:110:10:

          109|   isBuiltByBootstrapFilesCompiler =
          110|     pkg: isFromNixpkgs pkg && isFromBootstrapFiles pkg.stdenv.cc.cc;
             |          ^
          111|

       … while calling 'isFromNixpkgs'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:104:19:

          103|
          104|   isFromNixpkgs = pkg: !(isFromBootstrapFiles pkg);
             |                   ^
          105|   isFromBootstrapFiles =

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:104:26:

          103|
          104|   isFromNixpkgs = pkg: !(isFromBootstrapFiles pkg);
             |                          ^
          105|   isFromBootstrapFiles =

       … while calling 'isFromBootstrapFiles'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/linux/default.nix:106:5:

          105|   isFromBootstrapFiles =
          106|     pkg: pkg.passthru.isFromBootstrapFiles or false;
             |     ^
          107|   isBuiltByNixpkgsCompiler =

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:69:18:

           68|           cur  = op pred (builtins.elemAt list n) succ;
           69|           succ = go cur (n + 1);
             |                  ^
           70|         in cur;

       … while calling 'go'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:63:18:

           62|       len = builtins.length list;
           63|       go = pred: n:
             |                  ^
           64|         if n == len

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:89:33:

           88|   # debugging purposes.
           89|   folder = nextStage: stageFun: prevStage: let
             |                                 ^
           90|     args = stageFun prevStage;

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/stdenv/booter.nix:101:12:

          100|       then args'
          101|       else allPackages ((builtins.removeAttrs args' ["selfBuild"]) // {
             |            ^
          102|         adjacentPackages = if args.selfBuild or true then null else rec {

       … while calling 'allPackages'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/top-level/default.nix:132:17:

          131|   # sets. Only apply arguments which no stdenv would want to override.
          132|   allPackages = newArgs: import ./stage.nix ({
             |                 ^
          133|     inherit lib nixpkgsFun;

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/top-level/default.nix:132:26:

          131|   # sets. Only apply arguments which no stdenv would want to override.
          132|   allPackages = newArgs: import ./stage.nix ({
             |                          ^
          133|     inherit lib nixpkgsFun;

       … while calling anonymous lambda

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/top-level/stage.nix:19:1:

           18|
           19| { ## Misc parameters kept the same for all stages
             | ^
           20|   ##

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/pkgs/top-level/stage.nix:324:3:

          323|   # Return the complete set of packages.
          324|   lib.fix toFix
             |   ^
          325|

       … while calling 'fix'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/lib/fixed-points.nix:75:9:

           74|   */
           75|   fix = f: let x = f x; in x;
             |         ^
           76|

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/lib/fixed-points.nix:75:20:

           74|   */
           75|   fix = f: let x = f x; in x;
             |                    ^
           76|

       … while calling 'extends'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/lib/fixed-points.nix:248:7:

          247|     (
          248|       final:
             |       ^
          249|       let

       … from call site

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/lib/fixed-points.nix:250:16:

          249|       let
          250|         prev = f final;
             |                ^
          251|       in

       … while calling 'extends'

         at /nix/store/fn37f282c4a6c2620viijmn54hc4d0sb-nixos/nixos/lib/fixed-points.nix:248:7:

          247|     (
          248|       final:
             |       ^
          249|       let

       error: infinite recursion encountered

       at «none»:0: (source not available)

In this case configuration.nix should have nothing to do with this command, your NixOS config is only read if you use nixos-rebuild. This would only be a peoblem if you put something in your config to apply those overlays to your nix configuration as well.

This will originate somewhere in your nix configuration. Could you share the contents of:

  • /etc/nix/nix.conf
  • ~/.config/nix/nix.conf
  • $NIX_CONFIG
  • nix-channel --list

Thanks for your help.

/etc/nix/nix.conf:

# WARNING: this file is generated from the nix.* options in
# your NixOS configuration, typically
# /etc/nixos/configuration.nix.  Do not edit it!
allowed-users = *
auto-optimise-store = false
builders = 
cores = 0
max-jobs = auto
require-sigs = true
sandbox = true
sandbox-fallback = false
substituters = https://cache.nixos.org/
system-features = nixos-test benchmark big-parallel kvm
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
trusted-substituters = 
trusted-users = root
extra-sandbox-paths = 

~/.config/nix/nix.conf does not exist

$NIX_CONFIG is empty

nix-channel --list:

nixos-23.11 https://nixos.org/channels/nixos-23.11

sudo nix-channel --list:

nixos https://nixos.org/channels/nixos-unstable

These are my overlays:

  nixpkgs.overlays =
    let
      # Change this to a rev sha to pin
      moz-rev = "master";
      moz-url = builtins.fetchTarball { url = "https://github.com/mozilla/nixpkgs-mozilla/archive/${moz-rev}.tar.gz";};
      nightlyOverlay = (import "${moz-url}/firefox-overlay.nix");
    in [
      nightlyOverlay 
      (final: prev: {
        discord = prev.discord.overrideAttrs (old: {
          buildInputs = (old.buildInputs or []) ++ [ final.makeWrapper ];
	  postInstall = (old.postInstall or "") + ''
	    wrapProgram $out/bin/discord --add-flags '--disable-gpu'
	  '';
        });
      })
    ];

I do have a couple of notes:

This will mean that packages your user installs are from the stable NixOS branch, but your system is running unstable. Is that actually what you intend? Normally people do this the opposite way around, if at all.

You really ought to add a hash to that, as-is nix will update that repo for you every hour, you basically have nothing resembling reproducibility like this. niv can help.


Don’t see any immediate other issues with what you have shared so far, though. Can you share the rest of your system config? Is there anything else in ~/.config/nix? Reading the trace more closely it certainly looks like infinite recursion in some overlay is happening.

1 Like

Thank you, I was confused about the discrepancy in nix-channel --list with and without sudo, but had not looked into it yet. I have fixed that.

In general, how do I find the hash to be used for an overlay? Do I download the Tarball/source and rune nix-hash on it?

I have no ~/.config/nix folder. Here are the contents of /etc/nixos/configuration.nix:

# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];

  # Bootloader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  networking.hostName = "nixos"; # Define your hostname.
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.

  # Configure network proxy if necessary
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

  # Enable networking
  networking.networkmanager.enable = true;

  # Set your time zone.
  time.timeZone = "America/Los_Angeles";

  # Select internationalisation properties.
  i18n.defaultLocale = "en_US.UTF-8";

  i18n.extraLocaleSettings = {
    LC_ADDRESS = "en_US.UTF-8";
    LC_IDENTIFICATION = "en_US.UTF-8";
    LC_MEASUREMENT = "en_US.UTF-8";
    LC_MONETARY = "en_US.UTF-8";
    LC_NAME = "en_US.UTF-8";
    LC_NUMERIC = "en_US.UTF-8";
    LC_PAPER = "en_US.UTF-8";
    LC_TELEPHONE = "en_US.UTF-8";
    LC_TIME = "en_US.UTF-8";
  };

  # Enable the X11 windowing system.
  services.xserver.enable = true;
  services.xserver.excludePackages = with pkgs; [
    xterm
  ];

  # Enable the KDE Plasma Desktop Environment.
  services.displayManager.defaultSession = "plasma";
  services.displayManager.sddm.wayland.enable = true;
  services.desktopManager.plasma6.enable = true;
  services.desktopManager.plasma6.enableQt5Integration = true;
  environment.plasma6.excludePackages = with pkgs.libsForQt5; [
    elisa
    plasma-browser-integration
    konsole
    oxygen
  ];

  # Graphics
  hardware.opengl = {
    enable = true;
    driSupport = true;
    driSupport32Bit = true;
  };

  services.xserver.videoDrivers = [ "nvidia" ];

  hardware.nvidia = {
    modesetting.enable = true;
    powerManagement.enable = false;
    powerManagement.finegrained = false;
    nvidiaSettings = true;
  };

  # Logitech
  hardware.logitech.wireless.enable = true;
  hardware.logitech.wireless.enableGraphical = true;

  # Configure keymap in X11
  services.xserver.xkb= {
    layout = "us";
    variant = "";
  };

  # Enable CUPS to print documents.
  services.printing.enable = true;

  # Enable sound with pipewire.
  sound.enable = true;
  hardware.pulseaudio.enable = false;
  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
    # If you want to use JACK applications, uncomment this
    #jack.enable = true;

    # use the example session manager (no others are packaged yet so this is enabled by default,
    # no need to redefine it in your config for now)
    #media-session.enable = true;
  };

  # Enable touchpad support (enabled default in most desktopManager).
  # services.xserver.libinput.enable = true;

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.jjh = {
    isNormalUser = true;
    description = "JJ Hubbard";
    extraGroups = [ "networkmanager" "wheel" ];
    packages = with pkgs; [
    ];
  };

  # Allow unfree packages
  nixpkgs.config.allowUnfree = true;

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
     latest.firefox-nightly-bin
     wl-clipboard
     foot
     git
     betterdiscordctl
     asdf-vm
     fzf
     heroic
     lutris
     zoxide
     discord
     ntfs3g
     wget
     unzip
     gzip
     pigz
     solaar
     fastfetch
  ];

  programs.neovim = {
    enable = true;
    defaultEditor = true;
    configure = {
      packages.myVimPackage = with pkgs.vimPlugins; {
        start = [
	  vim-nix
	  nvim-lspconfig
	  mason-nvim
	  mason-lspconfig-nvim
	  fidget-nvim
	  nvim-cmp
	  harpoon
	  onedark-nvim
	];
      };
    };
  };

  programs.steam = {
    enable = true;
    remotePlay.openFirewall = true;
    dedicatedServer.openFirewall = true;
  };

  programs.zsh.enable = true;
  users.defaultUserShell = pkgs.zsh;

  nixpkgs.overlays =
    let
      # Change this to a rev sha to pin
      moz-rev = "master";
      moz-url = builtins.fetchTarball {
        url = "https://github.com/mozilla/nixpkgs-mozilla/archive/${moz-rev}.tar.gz";};
        hash="";
      nightlyOverlay = (import "${moz-url}/firefox-overlay.nix");
    in [
      nightlyOverlay 
      (final: prev: {
        discord = prev.discord.overrideAttrs (old: {
          buildInputs = (old.buildInputs or []) ++ [ final.makeWrapper ];
	  postInstall = (old.postInstall or "") + ''
	    wrapProgram $out/bin/discord --add-flags '--disable-gpu'
	  '';
        });
      })
    ];
 

  # Some programs need SUID wrappers, can be configured further or are
  # started in user sessions.
  # programs.mtr.enable = true;
  # programs.gnupg.agent = {
  #   enable = true;
  #   enableSSHSupport = true;
  # };

  # List services that you want to enable:

  # Enable the OpenSSH daemon.
  # services.openssh.enable = true;

  # Open ports in the firewall.
  # networking.firewall.allowedTCPPorts = [ ... ];
  # networking.firewall.allowedUDPPorts = [ ... ];
  # Or disable the firewall altogether.
  # networking.firewall.enable = false;

  # This value determines the NixOS release from which the default
  # settings for stateful data, like file locations and database versions
  # on your system were taken. It‘s perfectly fine and recommended to leave
  # this value at the release version of the first install of this system.
  # Before changing this value read the documentation for this option
  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
  system.stateVersion = "23.11"; # Did you read the comment?

}

Thanks a lot for your help so far. Much appreciated from a Nix noob.

I was able to figure out the hashing following these steps:

# If you don't know the hash, the first time, set:
      # hash = "";
      # then nix will fail the build with such an error message:
      # hash mismatch in fixed-output derivation '/nix/store/m1ga09c0z1a6n7rj8ky3s31dpgalsn0n-source':
      # specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
      # got:    sha256-173gxk0ymiw94glyjzjizp8bv8g72gwkjhacigd1an09jshdrjb4

from Overlays - NixOS Wiki, but using the sha256 argument of fetchTarball instead of hash.

1 Like

The issue was an overlay I had in ~/.config/nixpkgs/overlays/discord.nix. I remember attempting to make the discord overlay in /etc/nixos/configuration.nix its own overlay file for modularity. Deleting the ~/.config/nixpkgs/overlays folder solved the issue.