Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using nodes fixed point from a function in an option #94

Open
dminuoso opened this issue Jun 7, 2022 · 7 comments
Open

Error when using nodes fixed point from a function in an option #94

dminuoso opened this issue Jun 7, 2022 · 7 comments

Comments

@dminuoso
Copy link
Contributor

dminuoso commented Jun 7, 2022

When I use a function inside an option definition, which itself refers to other nodes config, I get an inexplicable error

[ERROR] error: The option `passthru' is used but not defined.

A reproducer can be found at https://github.com/dminuoso/colmena-fixed-point-bug

/ cat hive.nix 
{ 
  "foo" = { ... }: {
    config.networking.hostName = "foo";
    config.deployment.tags = ["fun"];
  };
  "bar" = { ... }: {
    config.networking.hostName = "bar";
    config.deployment.tags = ["fun"];
  };
  "quux" = { lib, config, ... }: {
    users.motd = lib.concatStringsSep "\n" (lib.mapAttrsToList (_name: host:
      host.config.networking.hostName
    ) (config.utils.nodesWithTag "fun"));
  };
  
  "defaults" = { name, lib, nodes, ... }:
    let
        utils = rec {
            nodesWithTag = tag: lib.filterAttrs (_name: host:
            builtins.elem tag host.config.deployment.tags
            ) nodes;
        };
    in {
        options.utils.nodesWithTag = lib.mkOption {
            type = with lib.types; anything;
            description = "Return all nodes that match the specified role";
            readOnly = true;
            default = utils.nodesWithTag;
        };
        config = {
            boot.loader.grub.devices = ["/dev/sda"];
            system.stateVersion = "22.05";
            fileSystems."/" =
                { device = "/dev/disk/by-uuid/94dcf2a2-07c2-4095-a6d5-a8249230a04e";
                fsType = "ext4";
                };
            };
    };
}
λ ~/wobcom/projects/nix/test-world/ colmena build
[INFO ] Enumerating nodes...
[INFO ] Selected all 3 nodes.
(...) ❌ 7s Evalation failed: Nix exited with error code: 1
[ERROR] Evaluation of 3 nodes failed. Logs:
[ERROR] trace: Obsolete option `jobs' is used. It was renamed to `systemd.services'.
[ERROR] error: The option `passthru' is used but not defined.
[ERROR] (use '--show-trace' to show detailed location information)
[ERROR] 
@dminuoso
Copy link
Contributor Author

dminuoso commented Jun 7, 2022

Stacktrace
[ERROR] Evaluation of 3 nodes failed. Logs:
[ERROR] trace: Obsolete option `jobs' is used. It was renamed to `systemd.services'.
[ERROR] error: The option `passthru' is used but not defined.
[ERROR] 
[ERROR]        … while evaluating the attribute 'mergedValue'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:617:5:
[ERROR] 
[ERROR]           616|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
[ERROR]           617|     mergedValue =
[ERROR]              |     ^
[ERROR]           618|       if isDefined then
[ERROR] 
[ERROR]        … while evaluating the option `passthru':
[ERROR] 
[ERROR]        … while evaluating the attribute 'value'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:585:9:
[ERROR] 
[ERROR]           584|     in warnDeprecation opt //
[ERROR]           585|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
[ERROR]              |         ^
[ERROR]           586|         inherit (res.defsFinal') highestPrio;
[ERROR] 
[ERROR]        … while evaluating anonymous lambda
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:171:72:
[ERROR] 
[ERROR]           170|           # For definitions that have an associated option
[ERROR]           171|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
[ERROR]              |                                                                        ^
[ERROR]           172|
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/attrsets.nix:304:20:
[ERROR] 
[ERROR]           303|               then recurse (path ++ [name]) value
[ERROR]           304|               else f (path ++ [name]) value;
[ERROR]              |                    ^
[ERROR]           305|         in mapAttrs g set;
[ERROR] 
[ERROR]        … while evaluating 'g'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/attrsets.nix:301:19:
[ERROR] 
[ERROR]           300|           g =
[ERROR]           301|             name: value:
[ERROR]              |                   ^
[ERROR]           302|             if isAttrs value && cond value
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        … while evaluating the attribute 'value'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/types.nix:404:60:
[ERROR] 
[ERROR]           403|           # Push down position info.
[ERROR]           404|           (map (def: mapAttrs (n: v: { inherit (def) file; value = v; }) def.value) defs)));
[ERROR]              |                                                            ^
[ERROR]           405|       emptyValue = { value = {}; };
[ERROR] 
[ERROR]        … while evaluating 'dischargeProperties'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:669:25:
[ERROR] 
[ERROR]           668|   */
[ERROR]           669|   dischargeProperties = def:
[ERROR]              |                         ^
[ERROR]           670|     if def._type or "" == "merge" then
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:598:137:
[ERROR] 
[ERROR]           597|         defs' = concatMap (m:
[ERROR]           598|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
[ERROR]              |                                                                                                                                         ^
[ERROR]           599|         ) defs;
[ERROR] 
[ERROR]        … while evaluating definitions from `<unknown-file>':
[ERROR] 
[ERROR]        … while evaluating anonymous lambda
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:597:28:
[ERROR] 
[ERROR]           596|         # Process mkMerge and mkIf properties.
[ERROR]           597|         defs' = concatMap (m:
[ERROR]              |                            ^
[ERROR]           598|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:597:17:
[ERROR] 
[ERROR]           596|         # Process mkMerge and mkIf properties.
[ERROR]           597|         defs' = concatMap (m:
[ERROR]              |                 ^
[ERROR]           598|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
[ERROR] 
[ERROR]        … while evaluating the attribute 'values'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:710:7:
[ERROR] 
[ERROR]           709|     in {
[ERROR]           710|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
[ERROR]              |       ^
[ERROR]           711|       inherit highestPrio;
[ERROR] 
[ERROR]        … while evaluating the attribute 'values'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:611:9:
[ERROR] 
[ERROR]           610|       in {
[ERROR]           611|         values = defs''';
[ERROR]              |         ^
[ERROR]           612|         inherit (defs'') highestPrio;
[ERROR] 
[ERROR]        … while evaluating the attribute 'optionalValue'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:629:5:
[ERROR] 
[ERROR]           628|
[ERROR]           629|     optionalValue =
[ERROR]              |     ^
[ERROR]           630|       if isDefined then { value = mergedValue; }
[ERROR] 
[ERROR]        … while evaluating anonymous lambda
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/types.nix:400:86:
[ERROR] 
[ERROR]           399|       merge = loc: defs:
[ERROR]           400|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
[ERROR]              |                                                                                      ^
[ERROR]           401|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/attrsets.nix:369:15:
[ERROR] 
[ERROR]           368|       inherit name;
[ERROR]           369|       value = f name (catAttrs name sets);
[ERROR]              |               ^
[ERROR]           370|     }) names);
[ERROR] 
[ERROR]        … while evaluating the attribute 'passthru'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/attrsets.nix:369:7:
[ERROR] 
[ERROR]           368|       inherit name;
[ERROR]           369|       value = f name (catAttrs name sets);
[ERROR]              |       ^
[ERROR]           370|     }) names);
[ERROR] 
[ERROR]        … while evaluating anonymous lambda
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/types.nix:400:51:
[ERROR] 
[ERROR]           399|       merge = loc: defs:
[ERROR]           400|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
[ERROR]              |                                                   ^
[ERROR]           401|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/attrsets.nix:128:62:
[ERROR] 
[ERROR]           127|   filterAttrs = pred: set:
[ERROR]           128|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
[ERROR]              |                                                              ^
[ERROR]           129|
[ERROR] 
[ERROR]        … while evaluating anonymous lambda
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/attrsets.nix:128:29:
[ERROR] 
[ERROR]           127|   filterAttrs = pred: set:
[ERROR]           128|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
[ERROR]              |                             ^
[ERROR]           129|
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/attrsets.nix:128:18:
[ERROR] 
[ERROR]           127|   filterAttrs = pred: set:
[ERROR]           128|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
[ERROR]              |                  ^
[ERROR]           129|
[ERROR] 
[ERROR]        … while evaluating 'filterAttrs'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/attrsets.nix:127:23:
[ERROR] 
[ERROR]           126|   */
[ERROR]           127|   filterAttrs = pred: set:
[ERROR]              |                       ^
[ERROR]           128|     listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/types.nix:400:35:
[ERROR] 
[ERROR]           399|       merge = loc: defs:
[ERROR]           400|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
[ERROR]              |                                   ^
[ERROR]           401|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue
[ERROR] 
[ERROR]        … while evaluating 'merge'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/types.nix:399:20:
[ERROR] 
[ERROR]           398|       check = isAttrs;
[ERROR]           399|       merge = loc: defs:
[ERROR]              |                    ^
[ERROR]           400|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/types.nix:203:12:
[ERROR] 
[ERROR]           202|           }.${commonType} or mergeEqualOption;
[ERROR]           203|         in mergeFunction loc defs;
[ERROR]              |            ^
[ERROR]           204|     };
[ERROR] 
[ERROR]        … while evaluating 'merge'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/types.nix:169:20:
[ERROR] 
[ERROR]           168|       check = value: true;
[ERROR]           169|       merge = loc: defs:
[ERROR]              |                    ^
[ERROR]           170|         let
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:619:59:
[ERROR] 
[ERROR]           618|       if isDefined then
[ERROR]           619|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
[ERROR]              |                                                           ^
[ERROR]           620|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;
[ERROR] 
[ERROR]        … while evaluating the attribute 'value'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:630:27:
[ERROR] 
[ERROR]           629|     optionalValue =
[ERROR]           630|       if isDefined then { value = mergedValue; }
[ERROR]              |                           ^
[ERROR]           631|       else {};
[ERROR] 
[ERROR]        … while evaluating anonymous lambda
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/types.nix:400:22:
[ERROR] 
[ERROR]           399|       merge = loc: defs:
[ERROR]           400|         mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
[ERROR]              |                      ^
[ERROR]           401|             (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        … while evaluating anonymous lambda
[ERROR] 
[ERROR]        at /home/dminuoso/wobcom/projects/nix/test-world/hive.nix:11:72:
[ERROR] 
[ERROR]            10|   "quux" = { lib, config, ... }: {
[ERROR]            11|     users.motd = lib.concatStringsSep "\n" (lib.mapAttrsToList (_name: host:
[ERROR]              |                                                                        ^
[ERROR]            12|       host.config.networking.hostName
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/attrsets.nix:259:16:
[ERROR] 
[ERROR]           258|   mapAttrsToList = f: attrs:
[ERROR]           259|     map (name: f name attrs.${name}) (attrNames attrs);
[ERROR]              |                ^
[ERROR]           260|
[ERROR] 
[ERROR]        … while evaluating anonymous lambda
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/attrsets.nix:259:10:
[ERROR] 
[ERROR]           258|   mapAttrsToList = f: attrs:
[ERROR]           259|     map (name: f name attrs.${name}) (attrNames attrs);
[ERROR]              |          ^
[ERROR]           260|
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        … while evaluating the attribute 'value'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:452:44:
[ERROR] 
[ERROR]           451|       defnsByName' = byName "config" (module: value:
[ERROR]           452|           [{ inherit (module) file; inherit value; }]
[ERROR]              |                                            ^
[ERROR]           453|         ) configs;
[ERROR] 
[ERROR]        … while evaluating 'dischargeProperties'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:669:25:
[ERROR] 
[ERROR]           668|   */
[ERROR]           669|   dischargeProperties = def:
[ERROR]              |                         ^
[ERROR]           670|     if def._type or "" == "merge" then
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:598:137:
[ERROR] 
[ERROR]           597|         defs' = concatMap (m:
[ERROR]           598|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
[ERROR]              |                                                                                                                                         ^
[ERROR]           599|         ) defs;
[ERROR] 
[ERROR]        … while evaluating definitions from `<unknown-file>':
[ERROR] 
[ERROR]        … while evaluating anonymous lambda
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:597:28:
[ERROR] 
[ERROR]           596|         # Process mkMerge and mkIf properties.
[ERROR]           597|         defs' = concatMap (m:
[ERROR]              |                            ^
[ERROR]           598|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:597:17:
[ERROR] 
[ERROR]           596|         # Process mkMerge and mkIf properties.
[ERROR]           597|         defs' = concatMap (m:
[ERROR]              |                 ^
[ERROR]           598|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
[ERROR] 
[ERROR]        … while evaluating the attribute 'values'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:710:7:
[ERROR] 
[ERROR]           709|     in {
[ERROR]           710|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
[ERROR]              |       ^
[ERROR]           711|       inherit highestPrio;
[ERROR] 
[ERROR]        … while evaluating the attribute 'values'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:611:9:
[ERROR] 
[ERROR]           610|       in {
[ERROR]           611|         values = defs''';
[ERROR]              |         ^
[ERROR]           612|         inherit (defs'') highestPrio;
[ERROR] 
[ERROR]        … while evaluating the attribute 'mergedValue'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:617:5:
[ERROR] 
[ERROR]           616|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
[ERROR]           617|     mergedValue =
[ERROR]              |     ^
[ERROR]           618|       if isDefined then
[ERROR] 
[ERROR]        … while evaluating the option `users.motd':
[ERROR] 
[ERROR]        … while evaluating the attribute 'value'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:585:9:
[ERROR] 
[ERROR]           584|     in warnDeprecation opt //
[ERROR]           585|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
[ERROR]              |         ^
[ERROR]           586|         inherit (res.defsFinal') highestPrio;
[ERROR] 
[ERROR]        … while evaluating anonymous lambda
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:171:72:
[ERROR] 
[ERROR]           170|           # For definitions that have an associated option
[ERROR]           171|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
[ERROR]              |                                                                        ^
[ERROR]           172|
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/attrsets.nix:304:20:
[ERROR] 
[ERROR]           303|               then recurse (path ++ [name]) value
[ERROR]           304|               else f (path ++ [name]) value;
[ERROR]              |                    ^
[ERROR]           305|         in mapAttrs g set;
[ERROR] 
[ERROR]        … while evaluating 'g'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/attrsets.nix:301:19:
[ERROR] 
[ERROR]           300|           g =
[ERROR]           301|             name: value:
[ERROR]              |                   ^
[ERROR]           302|             if isAttrs value && cond value
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        … while evaluating 'optionalString'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/strings.nix:202:5:
[ERROR] 
[ERROR]           201|     # String to return if condition is true
[ERROR]           202|     string: if cond then string else "";
[ERROR]              |     ^
[ERROR]           203|
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/nixos/modules/security/pam.nix:604:11:
[ERROR] 
[ERROR]           603|           '' +
[ERROR]           604|           optionalString (cfg.showMotd && config.users.motd != null) ''
[ERROR]              |           ^
[ERROR]           605|             session optional ${pkgs.pam}/lib/security/pam_motd.so motd=${motd}
[ERROR] 
[ERROR]        … while evaluating the attribute 'value.content'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:768:14:
[ERROR] 
[ERROR]           767|     { _type = "override";
[ERROR]           768|       inherit priority content;
[ERROR]              |              ^
[ERROR]           769|     };
[ERROR] 
[ERROR]        … while evaluating the attribute 'value._type'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:708:73:
[ERROR] 
[ERROR]           707|       highestPrio = foldl' (prio: def: min (getPrio def) prio) 9999 defs;
[ERROR]           708|       strip = def: if def.value._type or "" == "override" then def // { value = def.value.content; } else def;
[ERROR]              |                                                                         ^
[ERROR]           709|     in {
[ERROR] 
[ERROR]        … while evaluating anonymous lambda
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:607:19:
[ERROR] 
[ERROR]           606|           # Avoid sorting if we don't have to.
[ERROR]           607|           if any (def: def.value._type or "" == "order") defs''.values
[ERROR]              |                   ^
[ERROR]           608|           then sortProperties defs''.values
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:607:14:
[ERROR] 
[ERROR]           606|           # Avoid sorting if we don't have to.
[ERROR]           607|           if any (def: def.value._type or "" == "order") defs''.values
[ERROR]              |              ^
[ERROR]           608|           then sortProperties defs''.values
[ERROR] 
[ERROR]        … while evaluating the attribute 'values'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:611:9:
[ERROR] 
[ERROR]           610|       in {
[ERROR]           611|         values = defs''';
[ERROR]              |         ^
[ERROR]           612|         inherit (defs'') highestPrio;
[ERROR] 
[ERROR]        … while evaluating the attribute 'mergedValue'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:617:5:
[ERROR] 
[ERROR]           616|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
[ERROR]           617|     mergedValue =
[ERROR]              |     ^
[ERROR]           618|       if isDefined then
[ERROR] 
[ERROR]        … while evaluating the option `security.pam.services.login.text':
[ERROR] 
[ERROR]        … while evaluating the attribute 'value'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:585:9:
[ERROR] 
[ERROR]           584|     in warnDeprecation opt //
[ERROR]           585|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
[ERROR]              |         ^
[ERROR]           586|         inherit (res.defsFinal') highestPrio;
[ERROR] 
[ERROR]        … while evaluating anonymous lambda
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:171:72:
[ERROR] 
[ERROR]           170|           # For definitions that have an associated option
[ERROR]           171|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
[ERROR]              |                                                                        ^
[ERROR]           172|
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/attrsets.nix:304:20:
[ERROR] 
[ERROR]           303|               then recurse (path ++ [name]) value
[ERROR]           304|               else f (path ++ [name]) value;
[ERROR]              |                    ^
[ERROR]           305|         in mapAttrs g set;
[ERROR] 
[ERROR]        … while evaluating 'g'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/attrsets.nix:301:19:
[ERROR] 
[ERROR]           300|           g =
[ERROR]           301|             name: value:
[ERROR]              |                   ^
[ERROR]           302|             if isAttrs value && cond value
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        … while evaluating the attribute 'text' of the derivation 'login.pam'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/pkgs/stdenv/generic/make-derivation.nix:205:7:
[ERROR] 
[ERROR]           204|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
[ERROR]           205|       name =
[ERROR]              |       ^
[ERROR]           206|         let
[ERROR] 
[ERROR]        … while evaluating 'check'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/types.nix:362:15:
[ERROR] 
[ERROR]           361|       name = "path";
[ERROR]           362|       check = x: isCoercibleToString x && builtins.substring 0 1 (toString x) == "/";
[ERROR]              |               ^
[ERROR]           363|       merge = mergeEqualOption;
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:619:22:
[ERROR] 
[ERROR]           618|       if isDefined then
[ERROR]           619|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
[ERROR]              |                      ^
[ERROR]           620|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;
[ERROR] 
[ERROR]        … while evaluating anonymous lambda
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:619:17:
[ERROR] 
[ERROR]           618|       if isDefined then
[ERROR]           619|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
[ERROR]              |                 ^
[ERROR]           620|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:619:12:
[ERROR] 
[ERROR]           618|       if isDefined then
[ERROR]           619|         if all (def: type.check def.value) defsFinal then type.merge loc defsFinal
[ERROR]              |            ^
[ERROR]           620|         else let allInvalid = filter (def: ! type.check def.value) defsFinal;
[ERROR] 
[ERROR]        … while evaluating the attribute 'mergedValue'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:617:5:
[ERROR] 
[ERROR]           616|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
[ERROR]           617|     mergedValue =
[ERROR]              |     ^
[ERROR]           618|       if isDefined then
[ERROR] 
[ERROR]        … while evaluating the option `environment.etc.pam.d/login.source':
[ERROR] 
[ERROR]        … while evaluating the attribute 'value'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:585:9:
[ERROR] 
[ERROR]           584|     in warnDeprecation opt //
[ERROR]           585|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
[ERROR]              |         ^
[ERROR]           586|         inherit (res.defsFinal') highestPrio;
[ERROR] 
[ERROR]        … while evaluating anonymous lambda
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:171:72:
[ERROR] 
[ERROR]           170|           # For definitions that have an associated option
[ERROR]           171|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
[ERROR]              |                                                                        ^
[ERROR]           172|
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/attrsets.nix:304:20:
[ERROR] 
[ERROR]           303|               then recurse (path ++ [name]) value
[ERROR]           304|               else f (path ++ [name]) value;
[ERROR]              |                    ^
[ERROR]           305|         in mapAttrs g set;
[ERROR] 
[ERROR]        … while evaluating 'g'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/attrsets.nix:301:19:
[ERROR] 
[ERROR]           300|           g =
[ERROR]           301|             name: value:
[ERROR]              |                   ^
[ERROR]           302|             if isAttrs value && cond value
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        … while evaluating 'escapeShellArg'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/strings.nix:318:20:
[ERROR] 
[ERROR]           317|   */
[ERROR]           318|   escapeShellArg = arg: "'${replaceStrings ["'"] ["'\\''"] (toString arg)}'";
[ERROR]              |                    ^
[ERROR]           319|
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        … while evaluating 'concatMapStringsSep'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/strings.nix:110:5:
[ERROR] 
[ERROR]           109|     # List of input strings
[ERROR]           110|     list: concatStringsSep sep (map f list);
[ERROR]              |     ^
[ERROR]           111|
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/nixos/modules/system/etc/etc.nix:54:43:
[ERROR] 
[ERROR]            53|     mkdir -p "$out/etc"
[ERROR]            54|     ${concatMapStringsSep "\n" (etcEntry: escapeShellArgs [
[ERROR]              |                                           ^
[ERROR]            55|       "makeEtcEntry"
[ERROR] 
[ERROR]        … while evaluating anonymous lambda
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/nixos/modules/system/etc/etc.nix:54:33:
[ERROR] 
[ERROR]            53|     mkdir -p "$out/etc"
[ERROR]            54|     ${concatMapStringsSep "\n" (etcEntry: escapeShellArgs [
[ERROR]              |                                 ^
[ERROR]            55|       "makeEtcEntry"
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        … while evaluating 'concatMapStringsSep'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/strings.nix:110:5:
[ERROR] 
[ERROR]           109|     # List of input strings
[ERROR]           110|     list: concatStringsSep sep (map f list);
[ERROR]              |     ^
[ERROR]           111|
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/nixos/modules/system/etc/etc.nix:54:7:
[ERROR] 
[ERROR]            53|     mkdir -p "$out/etc"
[ERROR]            54|     ${concatMapStringsSep "\n" (etcEntry: escapeShellArgs [
[ERROR]              |       ^
[ERROR]            55|       "makeEtcEntry"
[ERROR] 
[ERROR]        … while evaluating the attribute 'buildCommand' of the derivation 'etc'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/pkgs/stdenv/generic/make-derivation.nix:205:7:
[ERROR] 
[ERROR]           204|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
[ERROR]           205|       name =
[ERROR]              |       ^
[ERROR]           206|         let
[ERROR] 
[ERROR]        … while evaluating the attribute 'value'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:452:44:
[ERROR] 
[ERROR]           451|       defnsByName' = byName "config" (module: value:
[ERROR]           452|           [{ inherit (module) file; inherit value; }]
[ERROR]              |                                            ^
[ERROR]           453|         ) configs;
[ERROR] 
[ERROR]        … while evaluating 'dischargeProperties'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:669:25:
[ERROR] 
[ERROR]           668|   */
[ERROR]           669|   dischargeProperties = def:
[ERROR]              |                         ^
[ERROR]           670|     if def._type or "" == "merge" then
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:598:137:
[ERROR] 
[ERROR]           597|         defs' = concatMap (m:
[ERROR]           598|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
[ERROR]              |                                                                                                                                         ^
[ERROR]           599|         ) defs;
[ERROR] 
[ERROR]        … while evaluating definitions from `/nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/nixos/modules/system/etc/etc.nix':
[ERROR] 
[ERROR]        … while evaluating anonymous lambda
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:597:28:
[ERROR] 
[ERROR]           596|         # Process mkMerge and mkIf properties.
[ERROR]           597|         defs' = concatMap (m:
[ERROR]              |                            ^
[ERROR]           598|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:597:17:
[ERROR] 
[ERROR]           596|         # Process mkMerge and mkIf properties.
[ERROR]           597|         defs' = concatMap (m:
[ERROR]              |                 ^
[ERROR]           598|           map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
[ERROR] 
[ERROR]        … while evaluating the attribute 'values'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:710:7:
[ERROR] 
[ERROR]           709|     in {
[ERROR]           710|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
[ERROR]              |       ^
[ERROR]           711|       inherit highestPrio;
[ERROR] 
[ERROR]        … while evaluating the attribute 'values'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:611:9:
[ERROR] 
[ERROR]           610|       in {
[ERROR]           611|         values = defs''';
[ERROR]              |         ^
[ERROR]           612|         inherit (defs'') highestPrio;
[ERROR] 
[ERROR]        … while evaluating the attribute 'mergedValue'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:617:5:
[ERROR] 
[ERROR]           616|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
[ERROR]           617|     mergedValue =
[ERROR]              |     ^
[ERROR]           618|       if isDefined then
[ERROR] 
[ERROR]        … while evaluating the option `system.activationScripts.etc.text':
[ERROR] 
[ERROR]        … while evaluating the attribute 'value'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:585:9:
[ERROR] 
[ERROR]           584|     in warnDeprecation opt //
[ERROR]           585|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
[ERROR]              |         ^
[ERROR]           586|         inherit (res.defsFinal') highestPrio;
[ERROR] 
[ERROR]        … while evaluating anonymous lambda
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/modules.nix:171:72:
[ERROR] 
[ERROR]           170|           # For definitions that have an associated option
[ERROR]           171|           declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options;
[ERROR]              |                                                                        ^
[ERROR]           172|
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/attrsets.nix:304:20:
[ERROR] 
[ERROR]           303|               then recurse (path ++ [name]) value
[ERROR]           304|               else f (path ++ [name]) value;
[ERROR]              |                    ^
[ERROR]           305|         in mapAttrs g set;
[ERROR] 
[ERROR]        … while evaluating 'g'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/attrsets.nix:301:19:
[ERROR] 
[ERROR]           300|           g =
[ERROR]           301|             name: value:
[ERROR]              |                   ^
[ERROR]           302|             if isAttrs value && cond value
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        … while evaluating the attribute 'text'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/nixos/modules/system/activation/activation-script.nix:9:5:
[ERROR] 
[ERROR]             8|   addAttributeName = mapAttrs (a: v: v // {
[ERROR]             9|     text = ''
[ERROR]              |     ^
[ERROR]            10|       #### Activation script snippet ${a}:
[ERROR] 
[ERROR]        … while evaluating 'id'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/trivial.nix:14:5:
[ERROR] 
[ERROR]            13|     # The value to return
[ERROR]            14|     x: x;
[ERROR]              |     ^
[ERROR]            15|
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        … while evaluating 'textClosureMap'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/lib/strings-with-deps.nix:75:35:
[ERROR] 
[ERROR]            74|
[ERROR]            75|   textClosureMap = f: predefined: names:
[ERROR]              |                                   ^
[ERROR]            76|     concatStringsSep "\n" (map f (textClosureList predefined names));
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/nixos/modules/system/activation/activation-script.nix:49:9:
[ERROR] 
[ERROR]            48|
[ERROR]            49|       ${textClosureMap id (withDrySnippets) (attrNames withDrySnippets)}
[ERROR]              |         ^
[ERROR]            50|
[ERROR] 
[ERROR]        … while evaluating 'systemActivationScript'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/nixos/modules/system/activation/activation-script.nix:20:33:
[ERROR] 
[ERROR]            19|
[ERROR]            20|   systemActivationScript = set: onlyDry: let
[ERROR]              |                                 ^
[ERROR]            21|     set' = mapAttrs (_: v: if isString v then (noDepEntry v) // { supportsDryActivation = false; } else v) set;
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/nixos/modules/system/activation/activation-script.nix:136:18:
[ERROR] 
[ERROR]           135|       apply = set: set // {
[ERROR]           136|         script = systemActivationScript set false;
[ERROR]              |                  ^
[ERROR]           137|       };
[ERROR] 
[ERROR]        … while evaluating the attribute 'system.activationScripts.script'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/nixos/modules/system/activation/activation-script.nix:136:9:
[ERROR] 
[ERROR]           135|       apply = set: set // {
[ERROR]           136|         script = systemActivationScript set false;
[ERROR]              |         ^
[ERROR]           137|       };
[ERROR] 
[ERROR]        … while evaluating the attribute 'activationScript' of the derivation 'nixos-system-nixos-21.11pre-git'
[ERROR] 
[ERROR]        at /nix/store/m3adrmbqamid0r5f9gq2dk8vzvhlipy5-source/pkgs/stdenv/generic/make-derivation.nix:205:7:
[ERROR] 
[ERROR]           204|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
[ERROR]           205|       name =
[ERROR]              |       ^
[ERROR]           206|         let
[ERROR] 
[ERROR]        … while evaluating anonymous lambda
[ERROR] 
[ERROR]        at /tmp/.tmpg9g1WI:461:46:
[ERROR] 
[ERROR]           460|     system = currentSystem;
[ERROR]           461|     json = toJSON (lib.attrsets.mapAttrs (k: v: toString v) selected);
[ERROR]              |                                              ^
[ERROR]           462|     builder = pkgs.writeScript "${name}.sh" ''
[ERROR] 
[ERROR]        … from call site
[ERROR] 
[ERROR]        … while evaluating the attribute 'json' of the derivation 'colmena-hive'
[ERROR] 
[ERROR]        at /tmp/.tmpg9g1WI:459:5:
[ERROR] 
[ERROR]           458|   in derivation rec {
[ERROR]           459|     name = "colmena-${hive.meta.name}";
[ERROR]              |     ^
[ERROR]           460|     system = currentSystem;
[ERROR] 

@roberth
Copy link

roberth commented Jun 7, 2022

First thing you'll want to do with these traces is grep for the option, which will usually tell you in which part of the config the problem occurs.
(It used to be that you could scan for this visually, since the fancy location reporting, that's just not feasible)

The top is closes to the problem, so for this trace, it's somewhere in a users.motd setting, which seems like a rather silly feature to be responsible for such breakage, but anyway, you might want to check if you've put anything odd in there. Its type is lines; a mergeable string type, but I think the problem is with an interpolated value in that string.

@dminuoso
Copy link
Contributor Author

dminuoso commented Jun 7, 2022

The example with the users.motd is just for a trivial reproducer with as few moving parts as possible.

I've managed to reduce the test case further.

The crux appears to be exposing the nodes fixed point through an option. See the following (git repo updated as well)

{ 
  "foo" = { ... }: {
    config.networking.hostName = "foo";
  };
  "quux" = { config, lib, ... }: with lib; {
    users.motd = config.utils.allNodes.foo.config.networking.hostName;
  };
  
  "defaults" = { name, lib, nodes, ... }:
    {
        options.utils.allNodes = lib.mkOption {
            type = lib.types.anything;
            readOnly = true;
            default = nodes;
        };
        config = {
            boot.loader.grub.devices = ["/dev/sda"];
            system.stateVersion = "22.05";
            fileSystems."/" =
                { device = "/dev/disk/by-uuid/94dcf2a2-07c2-4095-a6d5-a8249230a04e";
                fsType = "ext4";
                };
            };
    };
}

@dminuoso
Copy link
Contributor Author

dminuoso commented Jun 7, 2022

And for what its worth, I couldn't make heads or tails of the stack trace. If you have any pointers I'm all ears. The specific error usually occurs when you have something like { imports = [ path/to/drv.nix ]; }, but given all the context the error itself makes absolutely no sense. I don't even know where the option passthru is being set, allegedly.

@dminuoso
Copy link
Contributor Author

dminuoso commented Jun 7, 2022

What's even weirder, is that

{ 
  "foo" = { ... }: {
    config.networking.hostName = "foo";
  };
  "quux" = { config, lib, allNodes, ... }: with lib; {
    users.motd = allNodes.foo.config.networking.hostName;
  };
  
  "defaults" = { name, lib, nodes, ... }:
    {
        config = {
            _module.args.allNodes = nodes;
            boot.loader.grub.devices = ["/dev/sda"];
            system.stateVersion = "22.05";
            fileSystems."/" =
                { device = "/dev/disk/by-uuid/94dcf2a2-07c2-4095-a6d5-a8249230a04e";
                fsType = "ext4";
                };
            };
    };
}

works fine.

@dminuoso
Copy link
Contributor Author

dminuoso commented Jun 7, 2022

So there's some foul interaction with the nodes fixed point and the config fixed point.

@zhaofengli
Copy link
Owner

It appears to be related to config merging. The reproducer works if you suppress config merging for utils.allNodes:

--- a/hive.nix
+++ b/hive.nix
@@ -9,7 +9,7 @@
   "defaults" = { name, lib, nodes, ... }:
     {
         options.utils.allNodes = lib.mkOption {
-            type = lib.types.anything;
+            type = lib.types.raw;
             readOnly = true;
             default = nodes;
         };

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

No branches or pull requests

3 participants