I have the following nixos module:
{ config, zpool-root, root-domain, unstable, ... }:
let
domain = "paperless.${root-domain}";
in
{
config = {
services = {
paperless = {
enable = true;
address = "127.0.0.1";
port = 49203;
package = unstable.paperless-ngx;
user = config.users.users.main.name;
passwordFile = config.age.secrets.nas.path;
domain = domain;
settings = {
PAPERLESS_ADMIN_USER = config.users.users.main.name;
# PAPERLESS_OCR_USER_ARGS = { continue_on_soft_render_error = true; };
};
exporter = {
enable = true;
directory = "${zpool-root}/paperless";
};
};
traefik.dynamicConfigOptions.http = {
routers.paperless = {
rule = "Host(`${domain}`)";
service = "paperless";
};
services.paperless.loadbalancer.servers = [
{
url = "http://${config.services.paperless.address}:${builtins.toString config.services.paperless.port}";
}
];
};
};
};
}
But I’m getting the following error message, if I try to rebuild my config (full output with --show-trace):
error:
… while calling the 'seq' builtin
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:361:18:
360| options = checked options;
361| config = checked (removeAttrs config [ "_module" ]);
| ^
362| _module = checked (config._module);
… while evaluating the attribute 'unmatchedDefns'
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:894:7:
893| # Transforms unmatchedDefnsByName into a list of definitions
894| unmatchedDefns =
| ^
895| if configs == [ ] then
… while calling the 'concatLists' builtin
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:900:11:
899| else
900| concatLists (
| ^
901| mapAttrsToList (
… while calling anonymous lambda
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:902:21:
901| mapAttrsToList (
902| name: defs:
| ^
903| map (
… while calling the 'map' builtin
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:903:15:
902| name: defs:
903| map (
| ^
904| def:
… while calling anonymous lambda
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:886:22:
885| # Propagate all unmatched definitions from nested option sets
886| mapAttrs (n: v: v.unmatchedDefns) resultsByName
| ^
887| # Plus the definitions for the current prefix that don't have a matching option
… while evaluating the attribute 'unmatchedDefns'
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:894:7:
893| # Transforms unmatchedDefnsByName into a list of definitions
894| unmatchedDefns =
| ^
895| if configs == [ ] then
… while evaluating configs
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:895:12:
894| unmatchedDefns =
895| if configs == [ ] then
| ^
896| # When no config values exist, there can be no unmatched config, so
… while calling the 'concatLists' builtin
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:834:47:
833| loc = prefix ++ [ name ];
834| defns = pushedDownDefinitionsByName.${name} or [ ];
| ^
835| defns' = rawDefinitionsByName.${name} or [ ];
… while calling anonymous lambda
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:791:16:
790| mapAttrs (
791| n: value:
| ^
792| map (config: {
… while calling the 'map' builtin
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:792:13:
791| n: value:
792| map (config: {
| ^
793| inherit (module) file;
… from call site
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:795:17:
794| inherit config;
795| }) (pushDownProperties value)
| ^
796| ) module.config
… while calling 'pushDownProperties'
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1282:5:
1281| pushDownProperties =
1282| cfg:
| ^
1283| if cfg._type or "" == "merge" then
… while calling the 'map' builtin
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1286:7:
1285| else if cfg._type or "" == "if" then
1286| map (mapAttrs (n: v: mkIf cfg.condition v)) (pushDownProperties cfg.content)
| ^
1287| else if cfg._type or "" == "override" then
… from call site
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1286:52:
1285| else if cfg._type or "" == "if" then
1286| map (mapAttrs (n: v: mkIf cfg.condition v)) (pushDownProperties cfg.content)
| ^
1287| else if cfg._type or "" == "override" then
… while calling 'pushDownProperties'
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1282:5:
1281| pushDownProperties =
1282| cfg:
| ^
1283| if cfg._type or "" == "merge" then
… while evaluating an expression to select '_type' on it
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1283:8:
1282| cfg:
1283| if cfg._type or "" == "merge" then
| ^
1284| concatMap pushDownProperties cfg.contents
… while evaluating cfg
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1283:8:
1282| cfg:
1283| if cfg._type or "" == "merge" then
| ^
1284| concatMap pushDownProperties cfg.contents
… while evaluating the attribute 'content'
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1471:23:
1470| _type = "if";
1471| inherit condition content;
| ^
1472| };
… from call site
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/nixos/modules/services/misc/paperless.nix:630:17:
629|
630| users = lib.optionalAttrs (cfg.user == defaultUser) {
| ^
631| users.${defaultUser} = {
… while calling 'optionalAttrs'
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/attrsets.nix:1478:25:
1477| */
1478| optionalAttrs = cond: as: if cond then as else { };
| ^
1479|
… while evaluating cond
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/attrsets.nix:1478:32:
1477| */
1478| optionalAttrs = cond: as: if cond then as else { };
| ^
1479|
… from call site
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/nixos/modules/services/misc/paperless.nix:630:40:
629|
630| users = lib.optionalAttrs (cfg.user == defaultUser) {
| ^
631| users.${defaultUser} = {
… while calling anonymous lambda
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/attrsets.nix:1188:17:
1187| mapAttrs (
1188| name: value:
| ^
1189| if isAttrs value && cond value then recurse (path ++ [ name ]) value else f (path ++ [ name ]) value
… from call site
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/attrsets.nix:1189:85:
1188| name: value:
1189| if isAttrs value && cond value then recurse (path ++ [ name ]) value else f (path ++ [ name ]) value
| ^
1190| );
… while calling anonymous lambda
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:275:71:
274| # For definitions that have an associated option
275| declaredConfig = mapAttrsRecursiveCond (v: !isOption v) (_: v: v.value) options;
| ^
276|
… while evaluating the attribute 'value'
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1118:7:
1117| // {
1118| value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
1119| inherit (res.defsFinal') highestPrio;
… while calling the 'addErrorContext' builtin
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1118:15:
1117| // {
1118| value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
1119| inherit (res.defsFinal') highestPrio;
… while evaluating the option `services.paperless.user':
… while evaluating the attribute 'mergedValue'
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1192:5:
1191| # Type-check the remaining definitions, and merge them. Or throw if no definitions.
1192| mergedValue =
| ^
1193| if isDefined then
… while evaluating isDefined
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1193:10:
1192| mergedValue =
1193| if isDefined then
| ^
1194| if type.merge ? v2 then
… while evaluating defsFinal
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1254:17:
1253|
1254| isDefined = defsFinal != [ ];
| ^
1255|
… while evaluating the attribute 'values'
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1186:9:
1185| {
1186| values = defsSorted;
| ^
1187| inherit (defsFiltered) highestPrio;
… while calling the 'any' builtin
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1180:14:
1179| # Avoid sorting if we don't have to.
1180| if any (def: def.value._type or "" == "order") defsFiltered.values then
| ^
1181| sortProperties defsFiltered.values
… while evaluating the attribute 'values'
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1360:7:
1359| {
1360| values = concatMap (def: if getPrio def == highestPrio then [ (strip def) ] else [ ]) defs;
| ^
1361| inherit highestPrio;
… while calling the 'concatMap' builtin
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1360:16:
1359| {
1360| values = concatMap (def: if getPrio def == highestPrio then [ (strip def) ] else [ ]) defs;
| ^
1361| inherit highestPrio;
… while calling the 'concatMap' builtin
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1160:26:
1159| # Process mkMerge and mkIf properties.
1160| defsNormalized = concatMap (
| ^
1161| m:
… while calling anonymous lambda
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1161:11:
1160| defsNormalized = concatMap (
1161| m:
| ^
1162| map (
… while calling the 'map' builtin
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1162:11:
1161| m:
1162| map (
| ^
1163| value:
… while calling the 'addErrorContext' builtin
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1171:14:
1170| }
1171| ) (addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
| ^
1172| ) defs;
… while evaluating definitions from `/nix/store/2q7sxnl7jljxyb8r6d7aizldrylxmqy6-source/systems/nas/services/paperless.nix':
… from call site
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1171:80:
1170| }
1171| ) (addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
| ^
1172| ) defs;
… while calling 'dischargeProperties'
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1311:5:
1310| dischargeProperties =
1311| def:
| ^
1312| if def._type or "" == "merge" then
… while evaluating an expression to select '_type' on it
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1312:8:
1311| def:
1312| if def._type or "" == "merge" then
| ^
1313| concatMap dischargeProperties def.contents
… while evaluating def
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1312:8:
1311| def:
1312| if def._type or "" == "merge" then
| ^
1313| concatMap dischargeProperties def.contents
… while evaluating the attribute 'value'
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:805:21:
804| inherit (module) file;
805| inherit value;
| ^
806| }) module.config
… while evaluating an expression to select 'main' on it
at /nix/store/2q7sxnl7jljxyb8r6d7aizldrylxmqy6-source/systems/nas/services/paperless.nix:13:35:
12| package = unstable.paperless-ngx;
13| user = config.users.users.main.name;
| ^
14| passwordFile = config.age.secrets.nas.path;
… from call site
at /nix/store/2q7sxnl7jljxyb8r6d7aizldrylxmqy6-source/systems/nas/services/paperless.nix:13:16:
12| package = unstable.paperless-ngx;
13| user = config.users.users.main.name;
| ^
14| passwordFile = config.age.secrets.nas.path;
… while calling anonymous lambda
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/attrsets.nix:1188:17:
1187| mapAttrs (
1188| name: value:
| ^
1189| if isAttrs value && cond value then recurse (path ++ [ name ]) value else f (path ++ [ name ]) value
… from call site
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/attrsets.nix:1189:85:
1188| name: value:
1189| if isAttrs value && cond value then recurse (path ++ [ name ]) value else f (path ++ [ name ]) value
| ^
1190| );
… while calling anonymous lambda
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:275:71:
274| # For definitions that have an associated option
275| declaredConfig = mapAttrsRecursiveCond (v: !isOption v) (_: v: v.value) options;
| ^
276|
… while evaluating the attribute 'value'
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1118:7:
1117| // {
1118| value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
1119| inherit (res.defsFinal') highestPrio;
… while calling the 'addErrorContext' builtin
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1118:15:
1117| // {
1118| value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
1119| inherit (res.defsFinal') highestPrio;
… while evaluating the option `users.users':
(8 duplicate frames omitted)
… while evaluating defs
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:1087:12:
1086| })
1087| ++ defs;
| ^
1088|
… while evaluating an expression to select '"${...}"' on it
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:835:20:
834| defns = pushedDownDefinitionsByName.${name} or [ ];
835| defns' = rawDefinitionsByName.${name} or [ ];
| ^
836| optionDecls = filter (
… while evaluating rawDefinitionsByName
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:835:20:
834| defns = pushedDownDefinitionsByName.${name} or [ ];
835| defns' = rawDefinitionsByName.${name} or [ ];
| ^
836| optionDecls = filter (
… while calling the 'zipAttrsWith' builtin
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:800:30:
799| # extract the definitions for each loc
800| rawDefinitionsByName = zipAttrsWith (n: v: v) (
| ^
801| map (
… while calling the 'map' builtin
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:801:9:
800| rawDefinitionsByName = zipAttrsWith (n: v: v) (
801| map (
| ^
802| module:
… while calling the 'all' builtin
at /nix/store/dgp9wmspgm6zhl66f0c81rvg3v7wwbsb-source/lib/modules.nix:768:16:
767| checkedConfigs =
768| assert all (
| ^
769| c:
error: infinite recursion encountered
I don’t understand why I’m getting the infinite recursion.
I have this in another module which gets imported:
{...}: {
config = {
users = {
groups = {
plugdev = { };
};
users.main = {
name = "tornax";
# ...
};
};
};
}
So config.users.users.main.name shouldn’t require any recursion call?