Link to original chat for @ajhalili2006: https://github.com/copilot/c/df45f6a9-5e82-444d-b2fc-b1cac00c0e44 (see conversation_context.md also)
Got it but I got some headaches with recursion lately:
error:
… while calling anonymous lambda
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/attrsets.nix:1691:14:
1690| zipAttrsWith (
1691| n: values:
| ^
1692| let
… while calling the 'head' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/attrsets.nix:1696:13:
1695| if length values == 1 || pred here (elemAt values 1) (head values) then
1696| head values
| ^
1697| else
… while calling anonymous lambda
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/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 «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/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 «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/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 «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:1118:7:
1117| // {
1118| value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
1119| inherit (res.defsFinal') highestPrio;
… while evaluating the option `system.build.toplevel':
… while evaluating the attribute 'mergedValue'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:1189:5:
1188| # Type-check the remaining definitions, and merge them. Or throw if no definitions.
1189| mergedValue =
| ^
1190| if isDefined then
… while evaluating a branch condition
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:1190:7:
1189| mergedValue =
1190| if isDefined then
| ^
1191| if type.merge ? v2 then
… while evaluating the attribute 'values'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:1183:9:
1182| {
1183| values = defsSorted;
| ^
1184| inherit (defsFiltered) highestPrio;
… while evaluating a branch condition
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:1177:11:
1176| # Avoid sorting if we don't have to.
1177| if any (def: def.value._type or "" == "order") defsFiltered.values then
| ^
1178| sortProperties defsFiltered.values
… while calling the 'any' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:1177:14:
1176| # Avoid sorting if we don't have to.
1177| if any (def: def.value._type or "" == "order") defsFiltered.values then
| ^
1178| sortProperties defsFiltered.values
… while evaluating the attribute 'values'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:1357:7:
1356| {
1357| values = concatMap (def: if getPrio def == highestPrio then [ (strip def) ] else [ ]) defs;
| ^
1358| inherit highestPrio;
… while calling the 'concatMap' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:1357:16:
1356| {
1357| values = concatMap (def: if getPrio def == highestPrio then [ (strip def) ] else [ ]) defs;
| ^
1358| inherit highestPrio;
… while calling the 'concatMap' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:1157:26:
1156| # Process mkMerge and mkIf properties.
1157| defsNormalized = concatMap (
| ^
1158| m:
… while calling anonymous lambda
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:1158:11:
1157| defsNormalized = concatMap (
1158| m:
| ^
1159| map (
… while calling the 'map' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:1159:11:
1158| m:
1159| map (
| ^
1160| value:
… while evaluating definitions from `/nix/store/bbv0wny1zz4rx9r5312camy7as0zr5w9-source/nixos/modules/system/activation/top-level.nix':
… from call site
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:1168:80:
1167| }
1168| ) (addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
| ^
1169| ) defs;
… while calling 'dischargeProperties'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:1308:5:
1307| dischargeProperties =
1308| def:
| ^
1309| if def._type or "" == "merge" then
… while evaluating a branch condition
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:1309:5:
1308| def:
1309| if def._type or "" == "merge" then
| ^
1310| concatMap dischargeProperties def.contents
… while evaluating the attribute 'value'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:805:21:
804| inherit (module) file;
805| inherit value;
| ^
806| }) module.config
… from call site
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/nixos/modules/system/activation/top-level.nix:83:26:
82| # Handle assertions and warnings
83| baseSystemAssertWarn = lib.asserts.checkAssertWarn config.assertions config.warnings baseSystem;
| ^
84|
… while calling 'checkAssertWarn'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/asserts.nix:193:27:
192| checkAssertWarn =
193| assertions: warnings: val:
| ^
194| let
… while evaluating a branch condition
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/asserts.nix:197:5:
196| in
197| if failedAssertions != [ ] then
| ^
198| throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}"
… while calling the 'map' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/asserts.nix:195:26:
194| let
195| failedAssertions = map (x: x.message) (filter (x: !x.assertion) assertions);
| ^
196| in
… while calling the 'filter' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/asserts.nix:195:46:
194| let
195| failedAssertions = map (x: x.message) (filter (x: !x.assertion) assertions);
| ^
196| in
… from call site
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/nixos/modules/system/activation/top-level.nix:83:54:
82| # Handle assertions and warnings
83| baseSystemAssertWarn = lib.asserts.checkAssertWarn config.assertions config.warnings baseSystem;
| ^
84|
… while calling anonymous lambda
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/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 «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/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 «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/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 «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:1118:7:
1117| // {
1118| value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
1119| inherit (res.defsFinal') highestPrio;
… while evaluating the option `assertions':
(10 duplicate frames omitted)
… while evaluating definitions from `/nix/store/553sq15q5p4qraxx0vny8if77f0fykic-source/nixos/common.nix':
… from call site
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:1168:80:
1167| }
1168| ) (addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
| ^
1169| ) defs;
… while calling 'dischargeProperties'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:1308:5:
1307| dischargeProperties =
1308| def:
| ^
1309| if def._type or "" == "merge" then
… from call site
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:1313:31:
1312| if isBool def.condition then
1313| if def.condition then dischargeProperties def.content else [ ]
| ^
1314| else
… while calling 'dischargeProperties'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:1308:5:
1307| dischargeProperties =
1308| def:
| ^
1309| if def._type or "" == "merge" then
… while evaluating a branch condition
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:1309:5:
1308| def:
1309| if def._type or "" == "merge" then
| ^
1310| concatMap dischargeProperties def.contents
… while evaluating the attribute 'content'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:1468:23:
1467| _type = "if";
1468| inherit condition content;
| ^
1469| };
… from call site
at «github:nix-community/home-manager/af119fe»/nixos/common.nix:166:22:
165|
166| assertions = lib.flatten (
| ^
167| flip lib.mapAttrsToList cfg.users (
… while calling 'flatten'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/lists.nix:437:13:
436| */
437| flatten = x: if isList x then concatMap (y: flatten y) x else [ x ];
| ^
438|
… while calling the 'concatMap' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/lists.nix:437:33:
436| */
437| flatten = x: if isList x then concatMap (y: flatten y) x else [ x ];
| ^
438|
… while calling anonymous lambda
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/lists.nix:437:44:
436| */
437| flatten = x: if isList x then concatMap (y: flatten y) x else [ x ];
| ^
438|
… from call site
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/lists.nix:437:47:
436| */
437| flatten = x: if isList x then concatMap (y: flatten y) x else [ x ];
| ^
438|
… while calling 'flatten'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/lists.nix:437:13:
436| */
437| flatten = x: if isList x then concatMap (y: flatten y) x else [ x ];
| ^
438|
… while evaluating a branch condition
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/lists.nix:437:16:
436| */
437| flatten = x: if isList x then concatMap (y: flatten y) x else [ x ];
| ^
438|
… while calling the 'isList' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/lists.nix:437:19:
436| */
437| flatten = x: if isList x then concatMap (y: flatten y) x else [ x ];
| ^
438|
… while calling anonymous lambda
at «github:nix-community/home-manager/af119fe»/nixos/common.nix:168:19:
167| flip lib.mapAttrsToList cfg.users (
168| user: config:
| ^
169| flip map config.assertions (assertion: {
… from call site
at «github:nix-community/home-manager/af119fe»/nixos/common.nix:169:13:
168| user: config:
169| flip map config.assertions (assertion: {
| ^
170| inherit (assertion) assertion;
… while calling 'flip'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/trivial.nix:326:11:
325| flip =
326| f: a: b:
| ^
327| f b a;
… while calling the 'map' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/trivial.nix:327:5:
326| f: a: b:
327| f b a;
| ^
328|
… from call site
at «github:nix-community/home-manager/af119fe»/nixos/common.nix:169:22:
168| user: config:
169| flip map config.assertions (assertion: {
| ^
170| inherit (assertion) assertion;
… while calling anonymous lambda
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/types.nix:860:22:
859| value = mapAttrs (
860| n: v:
| ^
861| if lazy then
… while evaluating the attribute 'optionalValue.value'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:1253:41:
1252|
1253| optionalValue = if isDefined then { value = mergedValue; } else { };
| ^
1254| };
… while evaluating the attribute 'value'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/types.nix:1288:17:
1287| headError = checkDefsForError check loc defs;
1288| value = configuration.config;
| ^
1289| valueMeta = { inherit configuration; };
… while evaluating the attribute 'config'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:361:9:
360| options = checked options;
361| config = checked (removeAttrs config [ "_module" ]);
| ^
362| _module = checked (config._module);
… while calling the 'seq' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:361:18:
360| options = checked options;
361| config = checked (removeAttrs config [ "_module" ]);
| ^
362| _module = checked (config._module);
… while evaluating a branch condition
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:297:9:
296| checkUnmatched =
297| if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [ ] then
| ^
298| let
… in the left operand of the AND (&&) operator
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:297:72:
296| checkUnmatched =
297| if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [ ] then
| ^
298| let
… in the left operand of the AND (&&) operator
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:297:33:
296| checkUnmatched =
297| if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [ ] then
| ^
298| let
… while evaluating a branch condition
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:288:9:
287| in
288| if declaredConfig._module.freeformType == null then
| ^
289| declaredConfig
… from call site
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:275:28:
274| # For definitions that have an associated option
275| declaredConfig = mapAttrsRecursiveCond (v: !isOption v) (_: v: v.value) options;
| ^
276|
… while calling 'mapAttrsRecursiveCond'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/attrsets.nix:1183:14:
1182| mapAttrsRecursiveCond =
1183| cond: f: set:
| ^
1184| let
… while calling the 'mapAttrs' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/attrsets.nix:1192:5:
1191| in
1192| recurse [ ] set;
| ^
1193|
… while evaluating the attribute 'matchedOptions'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:891:15:
890| {
891| inherit matchedOptions;
| ^
892|
… while calling the 'mapAttrs' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:881:24:
880|
881| matchedOptions = mapAttrs (n: v: v.matchedOptions) resultsByName;
| ^
882|
… while calling the 'mapAttrs' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:829:23:
828|
829| resultsByName = mapAttrs (
| ^
830| name: decls:
… while calling the 'zipAttrsWith' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:745:21:
744| # an attrset 'name' => list of submodules that declare ‘name’.
745| declsByName = zipAttrsWith (n: v: v) (
| ^
746| map (
… while calling the 'map' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:746:9:
745| declsByName = zipAttrsWith (n: v: v) (
746| map (
| ^
747| module:
… from call site
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:267:37:
266|
267| merged = mergeModules prefix (reverseList (doCollect { }).modules);
| ^
268|
… while calling 'reverseList'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/lists.nix:1103:5:
1102| reverseList =
1103| xs:
| ^
1104| let
… while calling the 'genList' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/lists.nix:1107:5:
1106| in
1107| genList (n: elemAt xs (l - n - 1)) l;
| ^
1108|
… while evaluating the second argument passed to builtins.genList
… while calling the 'length' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/lists.nix:1105:11:
1104| let
1105| l = length xs;
| ^
1106| in
… while evaluating the attribute 'modules'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:550:7:
549| modulesPath: initialModules: args: {
550| modules = filterModules modulesPath (collectStructuredModules unknownModule "" initialModules args);
| ^
551| graph = toGraph modulesPath (collectStructuredModules unknownModule "" initialModules args);
… from call site
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:550:17:
549| modulesPath: initialModules: args: {
550| modules = filterModules modulesPath (collectStructuredModules unknownModule "" initialModules args);
| ^
551| graph = toGraph modulesPath (collectStructuredModules unknownModule "" initialModules args);
… while calling 'filterModules'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:525:9:
524| modulesPath:
525| { disabled, modules }:
| ^
526| let
… while calling the 'map' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:529:9:
528| in
529| map (attrs: attrs.module) (genericClosure {
| ^
530| startSet = keyFilter modules;
… while calling the 'genericClosure' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:529:36:
528| in
529| map (attrs: attrs.module) (genericClosure {
| ^
530| startSet = keyFilter modules;
… while calling the 'filter' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:530:22:
529| map (attrs: attrs.module) (genericClosure {
530| startSet = keyFilter modules;
| ^
531| operator = attrs: keyFilter attrs.modules;
… while calling anonymous lambda
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:527:31:
526| let
527| keyFilter = filter (attrs: !isDisabled modulesPath disabled attrs);
| ^
528| in
… in the argument of the not operator
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:527:39:
526| let
527| keyFilter = filter (attrs: !isDisabled modulesPath disabled attrs);
| ^
528| in
… from call site
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:527:39:
526| let
527| keyFilter = filter (attrs: !isDisabled modulesPath disabled attrs);
| ^
528| in
… while calling anonymous lambda
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:456:9:
455| in
456| structuredModule: elem structuredModule.key disabledKeys;
| ^
457|
… while calling the 'elem' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:456:27:
455| in
456| structuredModule: elem structuredModule.key disabledKeys;
| ^
457|
… while calling the 'concatMap' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:454:26:
453|
454| disabledKeys = concatMap ({ file, disabled }: map (moduleKey file) disabled) disabledList;
| ^
455| in
… while calling the 'concatLists' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:486:24:
485| collectResults = modules: {
486| disabled = concatLists (catAttrs "disabled" modules);
| ^
487| inherit modules;
… while evaluating the attribute 'disabled'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:486:13:
485| collectResults = modules: {
486| disabled = concatLists (catAttrs "disabled" modules);
| ^
487| inherit modules;
… while calling the 'concatLists' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:486:24:
485| collectResults = modules: {
486| disabled = concatLists (catAttrs "disabled" modules);
| ^
487| inherit modules;
… while evaluating the attribute 'disabled'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:486:13:
485| collectResults = modules: {
486| disabled = concatLists (catAttrs "disabled" modules);
| ^
487| inherit modules;
… while calling the 'concatLists' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:486:24:
485| collectResults = modules: {
486| disabled = concatLists (catAttrs "disabled" modules);
| ^
487| inherit modules;
… while evaluating the attribute 'disabled'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:486:13:
485| collectResults = modules: {
486| disabled = concatLists (catAttrs "disabled" modules);
| ^
487| inherit modules;
… while calling the 'concatLists' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:486:24:
485| collectResults = modules: {
486| disabled = concatLists (catAttrs "disabled" modules);
| ^
487| inherit modules;
… while evaluating a branch condition
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:504:19:
503| (
504| if module.disabledModules != [ ] then
| ^
505| [
… from call site
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:495:24:
494| let
495| module = checkModule (loadModule args parentFile "${parentKey}:anon-${toString n}" x);
| ^
496| collectedImports = collectStructuredModules module._file module.key module.imports args;
… while calling anonymous lambda
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:414:11:
413| if class != null then
414| m:
| ^
415| if m._class == null || m._class == class then
… while evaluating a branch condition
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:415:11:
414| m:
415| if m._class == null || m._class == class then
| ^
416| m
… in the left operand of the OR (||) operator
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:415:31:
414| m:
415| if m._class == null || m._class == class then
| ^
416| m
… from call site
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:495:37:
494| let
495| module = checkModule (loadModule args parentFile "${parentKey}:anon-${toString n}" x);
| ^
496| collectedImports = collectStructuredModules module._file module.key module.imports args;
… while calling 'loadModule'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:379:42:
378| loadModule =
379| args: fallbackFile: fallbackKey: m:
| ^
380| if isFunction m then
… while evaluating a branch condition
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:380:9:
379| args: fallbackFile: fallbackKey: m:
380| if isFunction m then
| ^
381| unifyModuleSyntax fallbackFile fallbackKey (applyModuleArgs fallbackKey m args)
… from call site
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:380:12:
379| args: fallbackFile: fallbackKey: m:
380| if isFunction m then
| ^
381| unifyModuleSyntax fallbackFile fallbackKey (applyModuleArgs fallbackKey m args)
… while calling 'isFunction'
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/trivial.nix:1043:16:
1042| */
1043| isFunction = f: builtins.isFunction f || (f ? __functor && isFunction (f.__functor f));
| ^
1044|
… in the left operand of the OR (||) operator
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/trivial.nix:1043:41:
1042| */
1043| isFunction = f: builtins.isFunction f || (f ? __functor && isFunction (f.__functor f));
| ^
1044|
… while calling the 'isFunction' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/trivial.nix:1043:19:
1042| */
1043| isFunction = f: builtins.isFunction f || (f ? __functor && isFunction (f.__functor f));
| ^
1044|
… while calling the 'elemAt' builtin
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/lists.nix:345:43:
344| */
345| imap1 = f: list: genList (n: f (n + 1) (elemAt list n)) (length list);
| ^
346|
… from call site
at /workspaces/ajhalili2006/nixops-config/shared/home-manager/main.nix:21:5:
20| ./fonts.nix
21| zen-browser.homeModules.beta #iykyk
| ^
22| ];
… while calling anonymous lambda
at «https://api.flakehub.com/f/pinned/DeterminateSystems/nixpkgs-weekly/0.1.888688%2Brev-7241bcbb4f099a66aafca120d37c65e8dda32717/019a4d5f-1342-7012-9c08-5af5fe8439c0/source.tar.gz»/lib/modules.nix:681:15:
680| extraArgs = mapAttrs (
681| name: _:
| ^
682| addErrorContext (context name) (
… while evaluating the module argument `zen-browser' in "/nix/store/yq386kqix7yxvvx2332z069q61paxvmk-source/shared/home-manager/main.nix":
… noting that argument `zen-browser` is not externally provided, so querying `_module.args` instead, requiring `config`
… if you get an infinite recursion here, you probably reference `config` in `imports`. If you are trying to achieve a conditional import behavior dependent on `config`, consider importing unconditionally, and using `mkEnableOption` and `mkIf` to control its effect.
Oof, that's a classic Nix infinite recursion error. They can look intimidating, but the error message itself gives us a very strong clue about what's wrong. Thank you for providing the full error trace and all the relevant files; it makes diagnosing this much easier.
Let's zero in on the most helpful part of the error message:
… while evaluating the module argument `zen-browser' in ".../shared/home-manager/main.nix":
… noting that argument `zen-browser` is not externally provided, so querying `_module.args` instead, requiring `config`
… if you get an infinite recursion here, you probably reference `config` in `imports`. If you are trying to achieve a conditional import behavior dependent on `config`, consider importing unconditionally, and using `mkEnableOption` and `mkIf` to control its effect.
This tells us three things:
- The problem is in
shared/home-manager/main.nix. - It's related to the
zen-browserargument. - The root cause is a circular dependency: an
importsstatement is trying to use a value that depends onconfig, butconfigcan't be built until all modules are imported.
Looking at your shared/home-manager/main.nix, we can see exactly where this happens:
{
config,
pkgs,
lib,
home-manager,
zen-browser, # This comes from your flake inputs
...
}:
{
imports = [
./packages.nix
./desktop.nix
./git.nix
./shell.nix
./fonts.nix
zen-browser.homeModules.beta # <-- THIS IS THE PROBLEM
];
# ...
}You are correctly trying to use the Home Manager module provided by the new 0xc000022070/zen-browser-flake. However, you're doing it inside the imports block of a module that receives zen-browser as a function argument. Nix sees this as: "To figure out the imports for main.nix, I need the zen-browser argument. But to know what zen-browser is, I have to evaluate the module arguments, which requires the final config... which requires the imports." And thus, infinite recursion.
The fix is to move the zen-browser Home Manager module import out of this file and into the place where you define your Home Manager configuration for the user. This is typically done in your NixOS configuration file where you set up home-manager.users.<username>.
Based on your file structure, the correct place to add this import is in hosts/stellapent-cier/users/gildedguy.nix.
Here is the corrected version of gildedguy.nix:
{ config, pkgs, lib, zen-browser, ... }:
{
imports = [
../../../shared/home-manager/main.nix
zen-browser.homeModules.beta # <-- Import it here
];
home.username = "gildedguy";
home.homeDirectory = "/home/gildedguy";
}And you need to remove the problematic line from shared/home-manager/main.nix:
# This is the meta configuration for my dotfiles with home-manager, except
# some home.{username,userDirectory} configs to ensure portability between
# hosts
{
config,
pkgs,
lib,
home-manager,
# We no longer need zen-browser passed in here
...
}:
{
imports = [
./packages.nix
./desktop.nix
./git.nix
./shell.nix
./fonts.nix
# zen-browser.homeModules.beta has been removed from here
];
# ... (The rest of the file remains the same)
# https://fnordig.de/til/nix/home-manager-allow-unfree.html
nixpkgs = {
config = {
allowUnfree = true;
# https://github.com/nix-community/home-manager/issues/2942
allowUnfreePredicate = (_: true);
};
};
# This value determines the Home Manager release that your configuration is
# compatible with. This helps avoid breakage when a new Home Manager release
# introduces backwards incompatible changes.
#
# You should not change this value, even if you update Home Manager. If you do
# want to update the value, then make sure to first check the Home Manager
# release notes.
home.stateVersion = "25.05"; # Please read the comment before changing.
home.sessionPath = [
"$HOME/bin"
"$HOME/.local/bin"
"$HOME/.nix-profile/bin"
"$HOME/.local/share/go/bin"
];
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
programs.vscode = {
enable = true;
package = pkgs.vscode;
profiles = {
default = {
enableExtensionUpdateCheck = true;
};
};
mutableExtensionsDir = true;
};
}By making this change, you are importing the zen-browser module at the top level of the user's configuration, which correctly resolves the dependency without causing recursion. You can now take full advantage of the programs.zen-browser options that the new flake provides in your other Home Manager files, like you already are in packages.nix.
That may work for home-manager on NixOS but what about on non-NixOS Linuxes (or those NixOS servers but w/o admin perms)?
That is an excellent and very important question. You've hit on the key difference between using Home-Manager as a NixOS module versus using it in standalone mode. My previous answer was tailored to your NixOS setup. For non-NixOS systems or unprivileged servers, you are correct that a different approach is needed.
The infinite recursion error is a side effect of how NixOS module arguments are passed. In a standalone Home-Manager setup, you define your configuration entry point differently, which neatly avoids this problem.
Here’s how you can structure your configuration to support both NixOS and standalone Home-Manager usage while sharing the bulk of your code.
In standalone mode, you typically have a home.nix file that serves as the entry point, and you build it via a homeConfigurations output in your flake.nix.
1. Create a Standalone Entry Point
Let's create a new file, for example at home/gildedguy/home.nix. This will be the main configuration file for your user when used outside of your NixOS setup. It will import the shared modules.
# This is the entry point for a standalone Home-Manager configuration.
{ pkgs, lib, zen-browser, ... }:
{
# This imports all your shared settings
imports = [
../../shared/home-manager/main.nix
zen-browser.homeModules.beta # <-- Import it here, just like the NixOS user file.
];
# Basic user info required by standalone Home-Manager
home.username = "gildedguy";
home.homeDirectory = "/home/gildedguy";
# This value should be consistent across all your Home-Manager configurations.
home.stateVersion = "25.05";
}Notice this file is very similar to the gildedguy.nix file for your NixOS host. It sets the user/home and pulls in all the shared logic.
2. Update Your flake.nix to Build Standalone Configurations
Now, you need to tell your flake how to build this standalone configuration. You do this by adding a homeConfigurations output to your main flake.nix.
{
description = "@ajhalili2006's nixpkgs + NixOS configurations";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
# You switched to the new zen-browser flake
zen-browser = {
url = "github:0xc000022070/zen-browser-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
# ... other inputs
};
outputs = { self, nixpkgs, home-manager, zen-browser, ... }@inputs: {
# Your existing NixOS configurations
nixosConfigurations = {
"stellapent-cier" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
# Pass flake inputs as arguments to your NixOS modules
inherit zen-browser;
# ... other specialArgs
};
modules = [
./hosts/stellapent-cier/configuration.nix
# You can also pass home-manager as a module here if you prefer
# home-manager.nixosModules.default
];
};
# ... other hosts
};
# NEW: Standalone Home-Manager configurations
homeConfigurations = {
# The name can be anything, but "user@host" is a common convention
"gildedguy-standalone" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = {
# Pass flake inputs as arguments to your Home-Manager modules
inherit zen-browser;
# ... other specialArgs
};
modules = [
# Point to your new standalone entry point
./home/gildedguy/home.nix
];
};
};
};
}-
On a non-NixOS machine (or unprivileged server):
- Make sure you have Nix and Home-Manager installed.
- Clone your
nixops-configrepository. - From within the repository, run:
# This builds and activates the 'gildedguy-standalone' configuration home-manager switch --flake .#gildedguy-standalone
-
On your NixOS machine (
stellapent-cier):- You continue to build as you always have:
sudo nixos-rebuild switch --flake .#stellapent-cier
- You continue to build as you always have:
The key is the extraSpecialArgs parameter in homeManagerConfiguration. It does the same job as specialArgs in nixosSystem: it makes your flake inputs (zen-browser, etc.) available as arguments to your modules.
Because the home.nix entry point receives zen-browser this way, you can safely import zen-browser.homeModules.beta within it without causing the infinite recursion you saw earlier. You've successfully separated the concerns of system configuration and user configuration, allowing you to reuse your dotfiles across any machine.