Sudden build time error on previously working builds

I’m very new to NixOS, and haven’t really dug into configuring my system beyond just the configuration.nix file. I added a few packages to my configuration and tried to rebuild, when I got this strange error that seems to reference files from the NixOS package itself? I can’t find anything online on this and nothing is working, I can’t even rebuild old generations without any changes anymore.

Here’s the full error trace.

error:
       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/attrsets.nix:918:24:

          917|     let f = attrPath:
          918|       zipAttrsWith (n: values:
             |                        ^
          919|         let here = attrPath ++ [n]; in

       … while calling 'g'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/attrsets.nix:701:19:

          700|           g =
          701|             name: value:
             |                   ^
          702|             if isAttrs value && cond value

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/attrsets.nix:704:20:

          703|               then recurse (path ++ [name]) value
          704|               else f (path ++ [name]) value;
             |                    ^
          705|         in mapAttrs g;

       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the option `system.build.toplevel':

       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:822:28:

          821|         # Process mkMerge and mkIf properties.
          822|         defs' = concatMap (m:
             |                            ^
          823|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating definitions from `/nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/nixos/modules/system/activation/top-level.nix':

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:823:137:

          822|         defs' = concatMap (m:
          823|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          824|         ) defs;

       … while calling 'dischargeProperties'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:894:25:

          893|   */
          894|   dischargeProperties = def:
             |                         ^
          895|     if def._type or "" == "merge" then

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/nixos/modules/system/activation/top-level.nix:71:12:

           70|   # Replace runtime dependencies
           71|   system = foldr ({ oldDependency, newDependency }: drv:
             |            ^
           72|       pkgs.replaceDependency { inherit oldDependency newDependency drv; }

       … while calling 'foldr'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/lists.nix:53:20:

           52|   */
           53|   foldr = op: nul: list:
             |                    ^
           54|     let

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/lists.nix:60:8:

           59|         else op (elemAt list n) (fold' (n + 1));
           60|     in fold' 0;
             |        ^
           61|

       … while calling 'fold''

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/lists.nix:56:15:

           55|       len = length list;
           56|       fold' = n:
             |               ^
           57|         if n == len

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/nixos/modules/system/activation/top-level.nix:68:10:

           67|     then throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}"
           68|     else showWarnings config.warnings baseSystem;
             |          ^
           69|

       … while calling 'showWarnings'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/trivial.nix:414:28:

          413|
          414|   showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings;
             |                            ^
          415|

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/trivial.nix:414:33:

          413|
          414|   showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings;
             |                                 ^
          415|

       … while calling 'foldr'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/lists.nix:53:20:

           52|   */
           53|   foldr = op: nul: list:
             |                    ^
           54|     let

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/lists.nix:60:8:

           59|         else op (elemAt list n) (fold' (n + 1));
           60|     in fold' 0;
             |        ^
           61|

       … while calling 'fold''

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/lists.nix:56:15:

           55|       len = length list;
           56|       fold' = n:
             |               ^
           57|         if n == len

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/nixos/modules/system/activation/top-level.nix:48:16:

           47|   # makes it bootable. See `activatable-system.nix`.
           48|   baseSystem = pkgs.stdenvNoCC.mkDerivation ({
             |                ^
           49|     name = "nixos-system-${config.system.name}-${config.system.nixos.label}";

       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/pkgs/stdenv/generic/make-derivation.nix:604:3:

          603| in
          604|   fnOrAttrs:
             |   ^
          605|     if builtins.isFunction fnOrAttrs

       … while calling 'g'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/attrsets.nix:701:19:

          700|           g =
          701|             name: value:
             |                   ^
          702|             if isAttrs value && cond value

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/attrsets.nix:704:20:

          703|               then recurse (path ++ [name]) value
          704|               else f (path ++ [name]) value;
             |                    ^
          705|         in mapAttrs g;

       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the option `system.systemBuilderArgs':

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:844:59:

          843|       if isDefined then
          844|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
             |                                                           ^
          845|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;

       … while calling 'merge'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/types.nix:562:20:

          561|       check = isAttrs;
          562|       merge = loc: defs:
             |                    ^
          563|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/types.nix:563:35:

          562|       merge = loc: defs:
          563|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                   ^
          564|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … while calling 'filterAttrs'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/attrsets.nix:381:5:

          380|     # The attribute set to filter
          381|     set:
             |     ^
          382|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));

       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/attrsets.nix:382:29:

          381|     set:
          382|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                             ^
          383|

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/attrsets.nix:382:62:

          381|     set:
          382|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                                                              ^
          383|

       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/types.nix:563:51:

          562|       merge = loc: defs:
          563|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                                   ^
          564|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/types.nix:563:86:

          562|       merge = loc: defs:
          563|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                                                                      ^
          564|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:822:28:

          821|         # Process mkMerge and mkIf properties.
          822|         defs' = concatMap (m:
             |                            ^
          823|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating definitions from `/nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/nixos/modules/system/activation/activatable-system.nix':

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:823:137:

          822|         defs' = concatMap (m:
          823|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          824|         ) defs;

       … while calling 'dischargeProperties'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:894:25:

          893|   */
          894|   dischargeProperties = def:
             |                         ^
          895|     if def._type or "" == "merge" then

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/nixos/modules/system/activation/activation-script.nix:133:18:

          132|       apply = set: set // {
          133|         script = systemActivationScript set false;
             |                  ^
          134|       };

       … while calling 'systemActivationScript'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/nixos/modules/system/activation/activation-script.nix:20:33:

           19|
           20|   systemActivationScript = set: onlyDry: let
             |                                 ^
           21|     set' = mapAttrs (_: v: if isString v then (noDepEntry v) // { supportsDryActivation = false; } else v) set;

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/nixos/modules/system/activation/activation-script.nix:49:9:

           48|
           49|       ${textClosureMap id (withDrySnippets) (attrNames withDrySnippets)}
             |         ^
           50|

       … while calling 'textClosureMap'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/strings-with-deps.nix:75:35:

           74|
           75|   textClosureMap = f: predefined: names:
             |                                   ^
           76|     concatStringsSep "\n" (map f (textClosureList predefined names));

       … while calling 'id'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/trivial.nix:14:5:

           13|     # The value to return
           14|     x: x;
             |     ^
           15|

       … while calling 'g'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/attrsets.nix:701:19:

          700|           g =
          701|             name: value:
             |                   ^
          702|             if isAttrs value && cond value

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/attrsets.nix:704:20:

          703|               then recurse (path ++ [name]) value
          704|               else f (path ++ [name]) value;
             |                    ^
          705|         in mapAttrs g;

       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the option `system.activationScripts.etc.text':

       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:822:28:

          821|         # Process mkMerge and mkIf properties.
          822|         defs' = concatMap (m:
             |                            ^
          823|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating definitions from `/nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/nixos/modules/system/etc/etc-activation.nix':

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:823:137:

          822|         defs' = concatMap (m:
          823|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          824|         ) defs;

       … while calling 'dischargeProperties'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:894:25:

          893|   */
          894|   dischargeProperties = def:
             |                         ^
          895|     if def._type or "" == "merge" then

       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/attrsets.nix:918:24:

          917|     let f = attrPath:
          918|       zipAttrsWith (n: values:
             |                        ^
          919|         let here = attrPath ++ [n]; in

       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/types.nix:587:29:

          586|       merge = loc: defs:
          587|         zipAttrsWith (name: defs:
             |                             ^
          588|           let merged = mergeDefinitions (loc ++ [name]) elemType defs;

       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:822:28:

          821|         # Process mkMerge and mkIf properties.
          822|         defs' = concatMap (m:
             |                            ^
          823|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating definitions from `/nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/nixos/modules/system/etc/etc.nix':

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:823:137:

          822|         defs' = concatMap (m:
          823|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          824|         ) defs;

       … while calling 'dischargeProperties'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:894:25:

          893|   */
          894|   dischargeProperties = def:
             |                         ^
          895|     if def._type or "" == "merge" then

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/attrsets.nix:160:39:

          159|         then value
          160|         else { ${elemAt attrPath n} = atDepth (n + 1); };
             |                                       ^
          161|     in atDepth 0;

       … while calling 'atDepth'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/attrsets.nix:157:17:

          156|       len = length attrPath;
          157|       atDepth = n:
             |                 ^
          158|         if n == len

       … while evaluating derivation 'etc'
         whose name attribute is located at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/pkgs/stdenv/generic/make-derivation.nix:348:7

       … while evaluating attribute 'buildCommand' of derivation 'etc'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/pkgs/build-support/trivial-builders/default.nix:87:14:

           86|       enableParallelBuilding = true;
           87|       inherit buildCommand name;
             |              ^
           88|       passAsFile = [ "buildCommand" ]

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/nixos/modules/system/etc/etc.nix:54:7:

           53|     mkdir -p "$out/etc"
           54|     ${concatMapStringsSep "\n" (etcEntry: escapeShellArgs [
             |       ^
           55|       "makeEtcEntry"

       … while calling 'concatMapStringsSep'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/strings.nix:117:5:

          116|     # List of input strings
          117|     list: concatStringsSep sep (map f list);
             |     ^
          118|

       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/nixos/modules/system/etc/etc.nix:54:33:

           53|     mkdir -p "$out/etc"
           54|     ${concatMapStringsSep "\n" (etcEntry: escapeShellArgs [
             |                                 ^
           55|       "makeEtcEntry"

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/nixos/modules/system/etc/etc.nix:54:43:

           53|     mkdir -p "$out/etc"
           54|     ${concatMapStringsSep "\n" (etcEntry: escapeShellArgs [
             |                                           ^
           55|       "makeEtcEntry"

       … while calling 'concatMapStringsSep'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/strings.nix:117:5:

          116|     # List of input strings
          117|     list: concatStringsSep sep (map f list);
             |     ^
          118|

       … while calling 'escapeShellArg'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/strings.nix:443:20:

          442|   */
          443|   escapeShellArg = arg: "'${replaceStrings ["'"] ["'\\''"] (toString arg)}'";
             |                    ^
          444|

       … while calling 'g'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/attrsets.nix:701:19:

          700|           g =
          701|             name: value:
             |                   ^
          702|             if isAttrs value && cond value

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/attrsets.nix:704:20:

          703|               then recurse (path ++ [name]) value
          704|               else f (path ++ [name]) value;
             |                    ^
          705|         in mapAttrs g;

       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the option `environment.etc.dbus-1.source':

       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:844:17:

          843|       if isDefined then
          844|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
             |                 ^
          845|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:844:22:

          843|       if isDefined then
          844|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
             |                      ^
          845|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;

       … while calling 'check'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/types.nix:515:15:

          514|       descriptionClass = "noun";
          515|       check = x: isStringLike x && builtins.substring 0 1 (toString x) == "/";
             |               ^
          516|       merge = mergeEqualOption;

       … while evaluating derivation 'dbus-1'
         whose name attribute is located at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/pkgs/stdenv/generic/make-derivation.nix:348:7

       … while evaluating attribute 'serviceDirectories' of derivation 'dbus-1'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/pkgs/development/libraries/dbus/make-dbus-conf.nix:18:12:

           17|   {
           18|     inherit serviceDirectories suidHelper apparmor;
             |            ^
           19|     preferLocalBuild = true;

       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/types.nix:533:14:

          532|       merge = loc: defs:
          533|         map (x: x.value) (filter (x: x ? value) (concatLists (imap1 (n: def:
             |              ^
          534|           imap1 (m: def':

       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:844:17:

          843|       if isDefined then
          844|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
             |                 ^
          845|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:844:22:

          843|       if isDefined then
          844|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
             |                      ^
          845|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;

       … while calling 'check'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/types.nix:515:15:

          514|       descriptionClass = "noun";
          515|       check = x: isStringLike x && builtins.substring 0 1 (toString x) == "/";
             |               ^
          516|       merge = mergeEqualOption;

       … while evaluating derivation 'system-path'
         whose name attribute is located at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/pkgs/stdenv/generic/make-derivation.nix:348:7

       … while evaluating attribute 'passAsFile' of derivation 'system-path'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/pkgs/build-support/trivial-builders/default.nix:88:7:

           87|       inherit buildCommand name;
           88|       passAsFile = [ "buildCommand" ]
             |       ^
           89|         ++ (derivationArgs.passAsFile or []);

       … while calling 'g'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/attrsets.nix:701:19:

          700|           g =
          701|             name: value:
             |                   ^
          702|             if isAttrs value && cond value

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/attrsets.nix:704:20:

          703|               then recurse (path ++ [name]) value
          704|               else f (path ++ [name]) value;
             |                    ^
          705|         in mapAttrs g;

       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the option `environment.systemPackages':

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:844:59:

          843|       if isDefined then
          844|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
             |                                                           ^
          845|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;

       … while calling 'merge'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/types.nix:532:20:

          531|       check = isList;
          532|       merge = loc: defs:
             |                    ^
          533|         map (x: x.value) (filter (x: x ? value) (concatLists (imap1 (n: def:

       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/types.nix:533:35:

          532|       merge = loc: defs:
          533|         map (x: x.value) (filter (x: x ? value) (concatLists (imap1 (n: def:
             |                                   ^
          534|           imap1 (m: def':

       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/lists.nix:165:29:

          164|   */
          165|   imap1 = f: list: genList (n: f (n + 1) (elemAt list n)) (length list);
             |                             ^
          166|

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/lists.nix:165:32:

          164|   */
          165|   imap1 = f: list: genList (n: f (n + 1) (elemAt list n)) (length list);
             |                                ^
          166|

       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/types.nix:534:21:

          533|         map (x: x.value) (filter (x: x ? value) (concatLists (imap1 (n: def:
          534|           imap1 (m: def':
             |                     ^
          535|             (mergeDefinitions

       … while calling anonymous lambda

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:822:28:

          821|         # Process mkMerge and mkIf properties.
          822|         defs' = concatMap (m:
             |                            ^
          823|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating definitions from `/etc/nixos/configuration.nix':

       … from call site

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:823:137:

          822|         defs' = concatMap (m:
          823|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          824|         ) defs;

       … while calling 'dischargeProperties'

         at /nix/store/k1i8sghsbwcwgw43mglmf634rc9p9mm8-nixos-23.11/nixos/lib/modules.nix:894:25:

          893|   */
          894|   dischargeProperties = def:
             |                         ^
          895|     if def._type or "" == "merge" then

       error: value is a function while a set was expected

Would be easier to help with the actual code, for now I can see:

       error: value is a function while a set was expected

suggesting that you are not providing the right object, but hard to say more without more info.

I have the same exact problem. Looks to me like it is something that has changed. Maybe an update ?

Here is my error. Using --show-trace:

building the system configuration...
error:
       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/attrsets.nix:1571:24:

         1570|     let f = attrPath:
         1571|       zipAttrsWith (n: values:
             |                        ^
         1572|         let here = attrPath ++ [n]; in

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/attrsets.nix:1205:18:

         1204|         mapAttrs
         1205|           (name: value:
             |                  ^
         1206|             if isAttrs value && cond value

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/attrsets.nix:1208:18:

         1207|             then recurse (path ++ [ name ]) value
         1208|             else f (path ++ [ name ]) value);
             |                  ^
         1209|     in

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the option `system.build.toplevel':

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:824:28:

          823|         # Process mkMerge and mkIf properties.
          824|         defs' = concatMap (m:
             |                            ^
          825|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating definitions from `/nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/nixos/modules/system/activation/top-level.nix':

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:825:137:

          824|         defs' = concatMap (m:
          825|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          826|         ) defs;

       … while calling 'dischargeProperties'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:896:25:

          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/nixos/modules/system/activation/top-level.nix:71:12:

           70|   # Replace runtime dependencies
           71|   system = foldr ({ oldDependency, newDependency }: drv:
             |            ^
           72|       pkgs.replaceDependency { inherit oldDependency newDependency drv; }

       … while calling 'foldr'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/lists.nix:121:20:

          120|   */
          121|   foldr = op: nul: list:
             |                    ^
          122|     let

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/lists.nix:128:8:

          127|         else op (elemAt list n) (fold' (n + 1));
          128|     in fold' 0;
             |        ^
          129|

       … while calling 'fold''

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/lists.nix:124:15:

          123|       len = length list;
          124|       fold' = n:
             |               ^
          125|         if n == len

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/nixos/modules/system/activation/top-level.nix:68:10:

           67|     then throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}"
           68|     else showWarnings config.warnings baseSystem;
             |          ^
           69|

       … while calling 'showWarnings'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/trivial.nix:867:28:

          866|
          867|   showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings;
             |                            ^
          868|

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/trivial.nix:867:33:

          866|
          867|   showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings;
             |                                 ^
          868|

       … while calling 'foldr'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/lists.nix:121:20:

          120|   */
          121|   foldr = op: nul: list:
             |                    ^
          122|     let

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/lists.nix:128:8:

          127|         else op (elemAt list n) (fold' (n + 1));
          128|     in fold' 0;
             |        ^
          129|

       … while calling 'fold''

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/lists.nix:124:15:

          123|       len = length list;
          124|       fold' = n:
             |               ^
          125|         if n == len

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/nixos/modules/system/activation/top-level.nix:48:16:

           47|   # makes it bootable. See `activatable-system.nix`.
           48|   baseSystem = pkgs.stdenvNoCC.mkDerivation ({
             |                ^
           49|     name = "nixos-system-${config.system.name}-${config.system.nixos.label}";

       … while calling 'mkDerivation'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/pkgs/stdenv/generic/make-derivation.nix:46:5:

           45|   mkDerivation =
           46|     fnOrAttrs:
             |     ^
           47|       if builtins.isFunction fnOrAttrs

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/attrsets.nix:1205:18:

         1204|         mapAttrs
         1205|           (name: value:
             |                  ^
         1206|             if isAttrs value && cond value

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/attrsets.nix:1208:18:

         1207|             then recurse (path ++ [ name ]) value
         1208|             else f (path ++ [ name ]) value);
             |                  ^
         1209|     in

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the option `system.systemBuilderArgs':

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:846:59:

          845|       if isDefined then
          846|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
             |                                                           ^
          847|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;

       … while calling 'merge'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/types.nix:583:20:

          582|       check = isAttrs;
          583|       merge = loc: defs:
             |                    ^
          584|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/types.nix:584:35:

          583|       merge = loc: defs:
          584|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                   ^
          585|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … while calling 'filterAttrs'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/attrsets.nix:646:5:

          645|     pred:
          646|     set:
             |     ^
          647|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/attrsets.nix:647:29:

          646|     set:
          647|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                             ^
          648|

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/attrsets.nix:647:62:

          646|     set:
          647|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
             |                                                              ^
          648|

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/types.nix:584:51:

          583|       merge = loc: defs:
          584|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                                   ^
          585|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/types.nix:584:86:

          583|       merge = loc: defs:
          584|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
             |                                                                                      ^
          585|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:824:28:

          823|         # Process mkMerge and mkIf properties.
          824|         defs' = concatMap (m:
             |                            ^
          825|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating definitions from `/nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/nixos/modules/system/activation/activatable-system.nix':

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:825:137:

          824|         defs' = concatMap (m:
          825|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          826|         ) defs;

       … while calling 'dischargeProperties'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:896:25:

          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/nixos/modules/system/activation/activation-script.nix:133:18:

          132|       apply = set: set // {
          133|         script = systemActivationScript set false;
             |                  ^
          134|       };

       … while calling 'systemActivationScript'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/nixos/modules/system/activation/activation-script.nix:20:33:

           19|
           20|   systemActivationScript = set: onlyDry: let
             |                                 ^
           21|     set' = mapAttrs (_: v: if isString v then (noDepEntry v) // { supportsDryActivation = false; } else v) set;

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/nixos/modules/system/activation/activation-script.nix:49:9:

           48|
           49|       ${textClosureMap id (withDrySnippets) (attrNames withDrySnippets)}
             |         ^
           50|

       … while calling 'textClosureMap'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/strings-with-deps.nix:75:35:

           74|
           75|   textClosureMap = f: predefined: names:
             |                                   ^
           76|     concatStringsSep "\n" (map f (textClosureList predefined names));

       … while calling 'id'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/trivial.nix:36:8:

           35|   */
           36|   id = x: x;
             |        ^
           37|

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/attrsets.nix:1205:18:

         1204|         mapAttrs
         1205|           (name: value:
             |                  ^
         1206|             if isAttrs value && cond value

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/attrsets.nix:1208:18:

         1207|             then recurse (path ++ [ name ]) value
         1208|             else f (path ++ [ name ]) value);
             |                  ^
         1209|     in

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the option `system.activationScripts.etc.text':

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:824:28:

          823|         # Process mkMerge and mkIf properties.
          824|         defs' = concatMap (m:
             |                            ^
          825|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating definitions from `/nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/nixos/modules/system/etc/etc-activation.nix':

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:825:137:

          824|         defs' = concatMap (m:
          825|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          826|         ) defs;

       … while calling 'dischargeProperties'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:896:25:

          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/attrsets.nix:1571:24:

         1570|     let f = attrPath:
         1571|       zipAttrsWith (n: values:
             |                        ^
         1572|         let here = attrPath ++ [n]; in

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/types.nix:608:29:

          607|       merge = loc: defs:
          608|         zipAttrsWith (name: defs:
             |                             ^
          609|           let merged = mergeDefinitions (loc ++ [name]) elemType defs;

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:824:28:

          823|         # Process mkMerge and mkIf properties.
          824|         defs' = concatMap (m:
             |                            ^
          825|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))

       … while evaluating definitions from `/nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/nixos/modules/system/etc/etc.nix':

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:825:137:

          824|         defs' = concatMap (m:
          825|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
             |                                                                                                                                         ^
          826|         ) defs;

       … while calling 'dischargeProperties'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:896:25:

          895|   */
          896|   dischargeProperties = def:
             |                         ^
          897|     if def._type or "" == "merge" then

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/attrsets.nix:273:39:

          272|         then value
          273|         else { ${elemAt attrPath n} = atDepth (n + 1); };
             |                                       ^
          274|     in atDepth 0;

       … while calling 'atDepth'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/attrsets.nix:270:17:

          269|       len = length attrPath;
          270|       atDepth = n:
             |                 ^
          271|         if n == len

       … while evaluating derivation 'etc'
         whose name attribute is located at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/pkgs/stdenv/generic/make-derivation.nix:331:7

       … while evaluating attribute 'buildCommand' of derivation 'etc'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/pkgs/build-support/trivial-builders/default.nix:68:16:

           67|         enableParallelBuilding = true;
           68|         inherit buildCommand name;
             |                ^
           69|         passAsFile = [ "buildCommand" ]

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/nixos/modules/system/etc/etc.nix:54:7:

           53|     mkdir -p "$out/etc"
           54|     ${concatMapStringsSep "\n" (etcEntry: escapeShellArgs [
             |       ^
           55|       "makeEtcEntry"

       … while calling 'concatMapStringsSep'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/strings.nix:116:5:

          115|     # List of input strings
          116|     list: concatStringsSep sep (map f list);
             |     ^
          117|

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/nixos/modules/system/etc/etc.nix:54:33:

           53|     mkdir -p "$out/etc"
           54|     ${concatMapStringsSep "\n" (etcEntry: escapeShellArgs [
             |                                 ^
           55|       "makeEtcEntry"

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/nixos/modules/system/etc/etc.nix:54:43:

           53|     mkdir -p "$out/etc"
           54|     ${concatMapStringsSep "\n" (etcEntry: escapeShellArgs [
             |                                           ^
           55|       "makeEtcEntry"

       … while calling 'concatMapStringsSep'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/strings.nix:116:5:

          115|     # List of input strings
          116|     list: concatStringsSep sep (map f list);
             |     ^
          117|

       … while calling 'escapeShellArg'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/strings.nix:454:20:

          453|   */
          454|   escapeShellArg = arg: "'${replaceStrings ["'"] ["'\\''"] (toString arg)}'";
             |                    ^
          455|

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/attrsets.nix:1205:18:

         1204|         mapAttrs
         1205|           (name: value:
             |                  ^
         1206|             if isAttrs value && cond value

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/attrsets.nix:1208:18:

         1207|             then recurse (path ++ [ name ]) value
         1208|             else f (path ++ [ name ]) value);
             |                  ^
         1209|     in

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:242:72:

          241|           # For definitions that have an associated option
          242|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
             |                                                                        ^
          243|

       … while evaluating the option `environment.etc.dbus-1.source':

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:846:17:

          845|       if isDefined then
          846|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
             |                 ^
          847|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:846:22:

          845|       if isDefined then
          846|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
             |                      ^
          847|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;

       … while calling 'check'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/types.nix:535:15:

          534|       descriptionClass = "noun";
          535|       check = x: isStringLike x && builtins.substring 0 1 (toString x) == "/";
             |               ^
          536|       merge = mergeEqualOption;

       … while evaluating derivation 'dbus-1'
         whose name attribute is located at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/pkgs/stdenv/generic/make-derivation.nix:331:7

       … while evaluating attribute 'serviceDirectories' of derivation 'dbus-1'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/pkgs/development/libraries/dbus/make-dbus-conf.nix:18:12:

           17|   {
           18|     inherit serviceDirectories suidHelper apparmor;
             |            ^
           19|     preferLocalBuild = true;

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/types.nix:553:14:

          552|       merge = loc: defs:
          553|         map (x: x.value) (filter (x: x ? value) (concatLists (imap1 (n: def:
             |              ^
          554|           imap1 (m: def':

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:846:17:

          845|       if isDefined then
          846|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
             |                 ^
          847|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:846:22:

          845|       if isDefined then
          846|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
             |                      ^
          847|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;

       … while calling 'check'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/types.nix:535:15:

          534|       descriptionClass = "noun";
          535|       check = x: isStringLike x && builtins.substring 0 1 (toString x) == "/";
             |               ^
          536|       merge = mergeEqualOption;

       … while evaluating derivation 'system-path'
         whose name attribute is located at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/pkgs/stdenv/generic/make-derivation.nix:331:7

       … while evaluating attribute 'passAsFile' of derivation 'system-path'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/pkgs/build-support/trivial-builders/default.nix:69:9:

           68|         inherit buildCommand name;
           69|         passAsFile = [ "buildCommand" ]
             |         ^
           70|           ++ (derivationArgs.passAsFile or [ ]);

       … while evaluating derivation 'X11-fonts'
         whose name attribute is located at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/pkgs/stdenv/generic/make-derivation.nix:331:7

       … while evaluating attribute 'buildCommand' of derivation 'X11-fonts'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/pkgs/build-support/trivial-builders/default.nix:68:16:

           67|         enableParallelBuilding = true;
           68|         inherit buildCommand name;
             |                ^
           69|         passAsFile = [ "buildCommand" ]

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/types.nix:553:14:

          552|       merge = loc: defs:
          553|         map (x: x.value) (filter (x: x ? value) (concatLists (imap1 (n: def:
             |              ^
          554|           imap1 (m: def':

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:846:17:

          845|       if isDefined then
          846|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
             |                 ^
          847|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:846:22:

          845|       if isDefined then
          846|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
             |                      ^
          847|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;

       … while calling 'check'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/types.nix:535:15:

          534|       descriptionClass = "noun";
          535|       check = x: isStringLike x && builtins.substring 0 1 (toString x) == "/";
             |               ^
          536|       merge = mergeEqualOption;

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/pkgs/stdenv/generic/make-derivation.nix:565:14:

          564|   };
          565|   validity = checkMeta.assertValidity { inherit meta attrs; };
             |              ^
          566|

       … while calling 'assertValidity'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/pkgs/stdenv/generic/check-meta.nix:501:20:

          500|
          501|   assertValidity = { meta, attrs }: let
             |                    ^
          502|       validity = checkValidity attrs;

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/pkgs/stdenv/generic/check-meta.nix:502:18:

          501|   assertValidity = { meta, attrs }: let
          502|       validity = checkValidity attrs;
             |                  ^
          503|       inherit (validity) valid;

       … while calling anonymous lambda

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/pkgs/stdenv/generic/check-meta.nix:400:5:

          399|     in
          400|     attrs:
             |     ^
          401|     # Check meta attribute types first, to make sure it is always called even when there are other issues

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/pkgs/stdenv/generic/check-meta.nix:418:13:

          417|       { valid = "no"; reason = "blocklisted"; errormsg = "has a blocklisted license (‘${showLicense attrs.meta.license}’)"; }
          418|     else if hasDeniedNonSourceProvenance attrs then
             |             ^
          419|       { valid = "no"; reason = "non-source"; errormsg = "contains elements not built from source (‘${showSourceType attrs.meta.sourceProvenance}’)"; }

       … while calling 'hasDeniedNonSourceProvenance'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/pkgs/stdenv/generic/check-meta.nix:153:34:

          152|   # `allowNonSourcePredicate` function.
          153|   hasDeniedNonSourceProvenance = attrs:
             |                                  ^
          154|     hasNonSourceProvenance attrs &&

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/pkgs/stdenv/generic/check-meta.nix:154:5:

          153|   hasDeniedNonSourceProvenance = attrs:
          154|     hasNonSourceProvenance attrs &&
             |     ^
          155|     !allowNonSource &&

       … while calling 'hasNonSourceProvenance'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/pkgs/stdenv/generic/check-meta.nix:137:28:

          136|
          137|   hasNonSourceProvenance = attrs:
             |                            ^
          138|     (attrs ? meta.sourceProvenance) &&

       … from call site

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/pkgs/stdenv/generic/check-meta.nix:139:5:

          138|     (attrs ? meta.sourceProvenance) &&
          139|     isNonSource attrs.meta.sourceProvenance;
             |     ^
          140|

       … while calling 'isNonSource'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/pkgs/stdenv/generic/check-meta.nix:135:17:

          134|
          135|   isNonSource = sourceTypes: any (t: !t.isSource) sourceTypes;
             |                 ^
          136|

       error: value is a set while a list was expected

SOLVED: For me it was an update in fonts packages, I removed not used fonts pkgs one by one and things are working again. Something broke on one of these packages:

comfortaa

  # comic-neue
  corefonts
  dejavu_fonts
  fira
  fira-code
  fira-go
  font-awesome
  # hackgen-nf-font
  # inconsolata
  # inter
  # iosevka-bin
  jetbrains-mono
  # jost
  # joypixels
  # lato
  # lexend
  # liberation_ttf
  # line-awesome
  material-design-icons
  material-icons
  nerd-font-patcher
  nerdfonts
  noto-fonts
  noto-fonts-cjk
  noto-fonts-emoji
  # roboto
  # source-han-sans
  # source-sans
  # source-serif
  # twemoji-color-font
  ubuntu_font_family
  # work-sans
  # roboto-mono
  # victor-mono
  # openmoji-color

I just encountered this as well when bumping Comparing ad57eef4ef0659193044870c731987a6df5cf56b..57610d2f8f0937f39dbd72251e9614b1561942d8 · NixOS/nixpkgs · GitHub. The important part of the trace is:

   … while evaluating attribute 'buildCommand' of derivation 'X11-fonts'

greping for the derivation name, it appears to be defined in a NixOS module. Looking at its source, this interpolation looks suspicious:

Checking the value of fonts.packages in my config with nixos-option, I see the following:

Value:
[
  «derivation /nix/store/gm1v8glccwvy6pw6x7m39i038xblmgkx-cantarell-fonts-0.303.1.drv»
  «derivation /nix/store/164asa1fa9y34z46qayjc49wlgrsrcjs-caladea-20130214.drv»
  «derivation /nix/store/fr5w07sqsvbimmv7xza4h3fxhq9lb14g-carlito-20130920.drv»
  «derivation /nix/store/y1z1x86lxiam6yla97ig9i5b9774mmrm-comic-relief-1.1.drv»
  «derivation /nix/store/phjfgz9wi0mqmbqr7dz5xg34is2gxksm-cm-unicode-0.7.0.drv»
  «derivation /nix/store/9gr14dk4pjfnfsmsj24c65bq91h3g01z-crimson-2014.10.drv»
  «derivation /nix/store/gs2fr9g0mm269r3s06y6lj43izi0vnk5-dejavu-fonts-2.37.drv»
  «derivation /nix/store/6b2pzk0px7v7p7z22lfw4944q8aq1gpv-fira-4.202.drv»
  «derivation /nix/store/4hnc1k9w8mih7kzxbnjx2fh14zv203wx-fira-mono-4.202.drv»
  «derivation /nix/store/zc4bqnln8nrkls78wxwp2jgjskg4sndc-gentium-6.200.drv»
  «derivation /nix/store/q8h4q883ihs77yc3xl9888gb4z4vq0jn-google-fonts-unstable-2023-10-20.drv»
  «derivation /nix/store/ynf5ms4mv0a3jxj5gky6wywvgdrq4s91-input-fonts-1.2.drv»
  «derivation /nix/store/yknq2r033wfbrrmvp55wm6nq9m3fpjs5-ipafont-003.03.drv»
  «derivation /nix/store/5g27wqnchaqin5r069bgi29p7yi5vp9n-ipaexfont-004.01.drv»
  «derivation /nix/store/4qy6bzwn4lbqsp3ianwvxj51yyz40l5g-league-of-moveable-type.drv»
  «derivation /nix/store/sb8gh6pv6jf4b4kfd422bpgycbsawgwc-linux-libertine-5.3.0.drv»
  «derivation /nix/store/78x0cxxlcdxxdi59afbm4midh07jy963-noto-fonts-color-emoji-2.042.drv»
  «error: error:
       … while evaluating the attribute 'value'

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:857:27:

          856|     optionalValue =
          857|       if isDefined then { value = mergedValue; }
             |                           ^
          858|       else {};

       … while evaluating a branch condition

         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:846:9:

          845|       if isDefined then
          846|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
             |         ^
          847|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: value is a set while a list was expected»
  «derivation /nix/store/2az3ks299n6zi9l628zz0x1k2n1q10iv-liberation-fonts-2.1.5.drv»
  «derivation /nix/store/099711cnjdsj4hc1yy6qbkjhpk5dzzja-libre-bodoni-2.000.drv»
  «derivation /nix/store/4m3pd3r1yznc3p1jn71in0r6f7pxrsdn-libre-caslon-1.002.drv»
  «derivation /nix/store/1ibpail5fl48rfksmx3awzr9ibhcimkf-lmmath-1.959.drv»
  «derivation /nix/store/lwaldd1qmb384qh13yxzmarc9pl4m309-lmodern-2.005.drv»
  «derivation /nix/store/yxfz67bm5a7kniaywv59n11nkiyxhg8s-source-code-pro-2.042.drv»
  «derivation /nix/store/0k7anaxd200yx5n65f0l7kphq5c4mz84-ubuntu-font-family-0.83.drv»
  «derivation /nix/store/gm1v8glccwvy6pw6x7m39i038xblmgkx-cantarell-fonts-0.303.1.drv»
  «derivation /nix/store/gs2fr9g0mm269r3s06y6lj43izi0vnk5-dejavu-fonts-2.37.drv»
  «derivation /nix/store/yxfz67bm5a7kniaywv59n11nkiyxhg8s-source-code-pro-2.042.drv»
  «derivation /nix/store/vlyg49jl5j5v8z2v6ya25lii263fsvr3-source-sans-3.052.drv»
  «derivation /nix/store/navli2isgr6hiv5y52an5xlbbjb4mzn2-font-cursor-misc-1.0.4.drv»
  «derivation /nix/store/49223i4v47xdc2aknjipbdp6pps8vw9j-font-misc-misc-1.1.3.drv»
  «derivation /nix/store/gs2fr9g0mm269r3s06y6lj43izi0vnk5-dejavu-fonts-2.37.drv»
  «derivation /nix/store/hxy5vxgl3kp5fy3dwjpgff63dnspisdk-freefont-ttf-20120503.drv»
  «derivation /nix/store/d9bp0h4nraicn4y4zrrj936n8jawdlqd-gyre-fonts-2.005.drv»
  «derivation /nix/store/2az3ks299n6zi9l628zz0x1k2n1q10iv-liberation-fonts-2.1.5.drv»
  «derivation /nix/store/80zfimvpa39pwqkqnxp7il4bybzwa1h1-unifont-15.1.05.drv»
  «derivation /nix/store/78x0cxxlcdxxdi59afbm4midh07jy963-noto-fonts-color-emoji-2.042.drv»
]

Diffing it with the output before the dump, JoyPixels are the culprit:

@@ -16,7 +17,28 @@
   «derivation /nix/store/4qy6bzwn4lbqsp3ianwvxj51yyz40l5g-league-of-moveable-type.drv»
   «derivation /nix/store/sb8gh6pv6jf4b4kfd422bpgycbsawgwc-linux-libertine-5.3.0.drv»
   «derivation /nix/store/78x0cxxlcdxxdi59afbm4midh07jy963-noto-fonts-color-emoji-2.042.drv»
-  «derivation /nix/store/8lfn4g1jvzjk7kajc2b8p3kjh8022in1-joypixels-6.6.0.drv»
+  «error: error:
+       … while evaluating the attribute 'value'
+
+         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:857:27:
+
+          856|     optionalValue =
+          857|       if isDefined then { value = mergedValue; }
+             |                           ^
+          858|       else {};
+
+       … while evaluating a branch condition
+
+         at /nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source/lib/modules.nix:846:9:
+
+          845|       if isDefined then
+          846|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
+             |         ^
+          847|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;
+
+       (stack trace truncated; use '--show-trace' to show the full trace)
+
+       error: value is a set while a list was expected»
   «derivation /nix/store/2az3ks299n6zi9l628zz0x1k2n1q10iv-liberation-fonts-2.1.5.drv»
   «derivation /nix/store/099711cnjdsj4hc1yy6qbkjhpk5dzzja-libre-bodoni-2.000.drv»
   «derivation /nix/store/4m3pd3r1yznc3p1jn71in0r6f7pxrsdn-libre-caslon-1.002.drv»

Looking at the source of the package, the issue should already be fixed in master: joypixels: fix sourceProvenance · NixOS/nixpkgs@53d993f · GitHub

Not sure why JoyPixels are not listed in the trace. We should probably also fix the provenance checking code in check-meta.nix to handle unexpected values early.

1 Like