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

Home-Manager module breaks when not included in the same place as home-manager itself #9

Closed
nikp123 opened this issue Sep 21, 2023 · 27 comments

Comments

@nikp123
Copy link

nikp123 commented Sep 21, 2023

Compared to your tests directory. I have a slightly different setup, but it seems no matter how i change my home-manager or system config it fails to load. I am indeed using flakes.

Example:
configuration.nix

   imports = [
     ./users/nikp123
   ];

And in my users/nikp123:

   { flakes, ... }: # flakes is where i keep my inputs
   {
      imports = {
        flakes.home-manager.....
      };
      
      users.users.nikp123 ...
      
      home-manager.users.nikp123 = ./home.nix; # here's where i keep my home-manager specific config
   }

and in home.nix:

{flakes, ... }: {
   imports = [
      flakes.flatpak.homeManagerModules.default # This fails
   ];
}

log:

nikp123@NotThink ~ [1]> sudo nixos-rebuild switch --show-trace
[sudo] password for nikp123: 
building the system configuration...
error:
       … while evaluating call site

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

       … while calling anonymous lambda

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/attrsets.nix:776:24:

          775|     let f = attrPath:
          776|       zipAttrsWith (n: values:
             |                        ^
          777|         let here = attrPath ++ [n]; in

       … while evaluating call site

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

       … while calling 'g'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/attrsets.nix:595:19:

          594|           g =
          595|             name: value:
             |                   ^
          596|             if isAttrs value && cond value

       … while evaluating call site

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/attrsets.nix:598:20:

          597|               then recurse (path ++ [name]) value
          598|               else f (path ++ [name]) value;
             |                    ^
          599|         in mapAttrs g;

       … while calling anonymous lambda

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:248:72:

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

       … while evaluating the attribute 'value'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:759:9:

          758|     in warnDeprecation opt //
          759|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          760|         inherit (res.defsFinal') highestPrio;

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

       … while evaluating the attribute 'mergedValue'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:794:5:

          793|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
          794|     mergedValue =
             |     ^
          795|       if isDefined then

       … while evaluating the attribute 'values'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:788:9:

          787|       in {
          788|         values = defs''';
             |         ^
          789|         inherit (defs'') highestPrio;

       … while evaluating the attribute 'values'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:887:7:

          886|     in {
          887|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
             |       ^
          888|       inherit highestPrio;

       … while evaluating call site

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:774:17:

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

       … while calling anonymous lambda

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:774:28:

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

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

       … while evaluating call site

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:775:137:

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

       … while calling 'dischargeProperties'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:846:25:

          845|   */
          846|   dischargeProperties = def:
             |                         ^
          847|     if def._type or "" == "merge" then

       … while evaluating the attribute 'value'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:599:44:

          598|       defnsByName' = byName "config" (module: value:
          599|           [{ inherit (module) file; inherit value; }]
             |                                            ^
          600|         ) configs;

       … while evaluating call site

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/nixos/modules/system/activation/top-level.nix:131:12:

          130|   # Replace runtime dependencies
          131|   system = foldr ({ oldDependency, newDependency }: drv:
             |            ^
          132|       pkgs.replaceDependency { inherit oldDependency newDependency drv; }

       … while calling 'foldr'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/lists.nix:53:20:

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

       … while evaluating call site

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/lists.nix:60:8:

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

       … while calling 'fold''

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/lists.nix:56:15:

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

       … while evaluating call site

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

       … while calling 'g'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/attrsets.nix:595:19:

          594|           g =
          595|             name: value:
             |                   ^
          596|             if isAttrs value && cond value

       … while evaluating call site

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/attrsets.nix:598:20:

          597|               then recurse (path ++ [name]) value
          598|               else f (path ++ [name]) value;
             |                    ^
          599|         in mapAttrs g;

       … while calling anonymous lambda

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:248:72:

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

       … while evaluating the attribute 'value'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:759:9:

          758|     in warnDeprecation opt //
          759|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          760|         inherit (res.defsFinal') highestPrio;

       … while evaluating the option `assertions':

       … while evaluating the attribute 'mergedValue'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:794:5:

          793|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
          794|     mergedValue =
             |     ^
          795|       if isDefined then

       … while evaluating the attribute 'values'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:788:9:

          787|       in {
          788|         values = defs''';
             |         ^
          789|         inherit (defs'') highestPrio;

       … while evaluating the attribute 'values'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:887:7:

          886|     in {
          887|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
             |       ^
          888|       inherit highestPrio;

       … while evaluating call site

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:774:17:

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

       … while calling anonymous lambda

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:774:28:

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

       … while evaluating definitions from `/nix/store/9zb3gaikis7qsnygj9iwh0c6sz8jf6ax-source/nixos/common.nix':

       … while evaluating call site

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:775:137:

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

       … while calling 'dischargeProperties'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:846:25:

          845|   */
          846|   dischargeProperties = def:
             |                         ^
          847|     if def._type or "" == "merge" then

       … while evaluating call site

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:852:11:

          851|         if def.condition then
          852|           dischargeProperties def.content
             |           ^
          853|         else

       … while calling 'dischargeProperties'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:846:25:

          845|   */
          846|   dischargeProperties = def:
             |                         ^
          847|     if def._type or "" == "merge" then

       … while evaluating the attribute 'content'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:917:14:

          916|     { _type = "if";
          917|       inherit condition content;
             |              ^
          918|     };

       … while evaluating call site

       at /nix/store/9zb3gaikis7qsnygj9iwh0c6sz8jf6ax-source/nixos/common.nix:103:18:

          102|
          103|     assertions = flatten (flip mapAttrsToList cfg.users (user: config:
             |                  ^
          104|       flip map config.assertions (assertion: {

       … while calling 'flatten'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/lists.nix:138:13:

          137|   */
          138|   flatten = x:
             |             ^
          139|     if isList x

       … while evaluating call site

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/lists.nix:140:10:

          139|     if isList x
          140|     then concatMap (y: flatten y) x
             |          ^
          141|     else [x];

       … while calling anonymous lambda

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/lists.nix:140:21:

          139|     if isList x
          140|     then concatMap (y: flatten y) x
             |                     ^
          141|     else [x];

       … while evaluating call site

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/lists.nix:140:24:

          139|     if isList x
          140|     then concatMap (y: flatten y) x
             |                        ^
          141|     else [x];

       … while calling 'flatten'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/lists.nix:138:13:

          137|   */
          138|   flatten = x:
             |             ^
          139|     if isList x

       … while evaluating call site

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

       … while calling anonymous lambda

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/attrsets.nix:539:10:

          538|     attrs:
          539|     map (name: f name attrs.${name}) (attrNames attrs);
             |          ^
          540|

       … while evaluating call site

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/attrsets.nix:539:16:

          538|     attrs:
          539|     map (name: f name attrs.${name}) (attrNames attrs);
             |                ^
          540|

       … while calling anonymous lambda

       at /nix/store/9zb3gaikis7qsnygj9iwh0c6sz8jf6ax-source/nixos/common.nix:103:64:

          102|
          103|     assertions = flatten (flip mapAttrsToList cfg.users (user: config:
             |                                                                ^
          104|       flip map config.assertions (assertion: {

       … while evaluating call site

       at /nix/store/9zb3gaikis7qsnygj9iwh0c6sz8jf6ax-source/nixos/common.nix:104:7:

          103|     assertions = flatten (flip mapAttrsToList cfg.users (user: config:
          104|       flip map config.assertions (assertion: {
             |       ^
          105|         inherit (assertion) assertion;

       … while calling 'flip'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/trivial.nix:138:16:

          137|   */
          138|   flip = f: a: b: f b a;
             |                ^
          139|

       … while evaluating call site

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

       … while calling anonymous lambda

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/types.nix:530:22:

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

       … while evaluating the attribute 'value'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:807:27:

          806|     optionalValue =
          807|       if isDefined then { value = mergedValue; }
             |                           ^
          808|       else {};

       … while evaluating call site

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:796:59:

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

       … while calling 'merge'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/types.nix:751:22:

          750|         check = x: isAttrs x || isFunction x || path.check x;
          751|         merge = loc: defs:
             |                      ^
          752|           (base.extendModules {

       … while evaluating the attribute 'config'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:326:9:

          325|         options = checked options;
          326|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          327|         _module = checked (config._module);

       … while evaluating call site

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:248:28:

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

       … while calling 'mapAttrsRecursiveCond'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/attrsets.nix:590:5:

          589|     # Attribute set to recursively map over.
          590|     set:
             |     ^
          591|     let

       … while evaluating the attribute 'matchedOptions'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:668:14:

          667|     in {
          668|       inherit matchedOptions;
             |              ^
          669|

       … while evaluating call site

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:590:21:

          589|       # an attrset 'name' => list of submodules that declare ‘name’.
          590|       declsByName = byName "options" (module: option:
             |                     ^
          591|           [{ inherit (module) _file; options = option; }]

       … while calling 'byName'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:569:25:

          568|       */
          569|       byName = attr: f: modules:
             |                         ^
          570|         zipAttrsWith (n: concatLists)

       … while evaluating call site

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:240:33:

          239|           ({ inherit lib options config specialArgs; } // specialArgs);
          240|         in mergeModules prefix (reverseList collected);
             |                                 ^
          241|

       … while calling 'reverseList'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/lists.nix:406:17:

          405|   */
          406|   reverseList = xs:
             |                 ^
          407|     let l = length xs; in genList (n: elemAt xs (l - n - 1)) l;

       … while evaluating call site

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:235:25:

          234|       merged =
          235|         let collected = collectModules
             |                         ^
          236|           class

       … while calling anonymous lambda

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:449:37:

          448|
          449|     in modulesPath: initialModules: args:
             |                                     ^
          450|       filterModules modulesPath (collectStructuredModules unknownModule "" initialModules args);

       … while evaluating call site

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:450:7:

          449|     in modulesPath: initialModules: args:
          450|       filterModules modulesPath (collectStructuredModules unknownModule "" initialModules args);
             |       ^
          451|

       … while calling 'filterModules'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:417:36:

          416|       # modules recursively. It returns the final list of unique-by-key modules
          417|       filterModules = modulesPath: { disabled, modules }:
             |                                    ^
          418|         let

       … while evaluating call site

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

       … while calling anonymous lambda

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:443:31:

          442|           disabledKeys = concatMap ({ file, disabled }: map (moduleKey file) disabled) disabled;
          443|           keyFilter = filter (attrs: ! elem attrs.key disabledKeys);
             |                               ^
          444|         in map (attrs: attrs.module) (builtins.genericClosure {

       … while evaluating the attribute 'disabled'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:399:13:

          398|           collectResults = modules: {
          399|             disabled = concatLists (catAttrs "disabled" modules);
             |             ^
          400|             inherit modules;

       … while evaluating the attribute 'disabled'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:399:13:

          398|           collectResults = modules: {
          399|             disabled = concatLists (catAttrs "disabled" modules);
             |             ^
          400|             inherit modules;

       … while evaluating call site

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:404:22:

          403|           let
          404|             module = checkModule (loadModule args parentFile "${parentKey}:anon-${toString n}" x);
             |                      ^
          405|             collectedImports = collectStructuredModules module._file module.key module.imports args;

       … while calling anonymous lambda

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:369:11:

          368|         else
          369|           m: m;
             |           ^
          370|

       … while evaluating call site

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:404:35:

          403|           let
          404|             module = checkModule (loadModule args parentFile "${parentKey}:anon-${toString n}" x);
             |                                   ^
          405|             collectedImports = collectStructuredModules module._file module.key module.imports args;

       … while calling 'loadModule'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:340:53:

          339|       # Like unifyModuleSyntax, but also imports paths and calls functions if necessary
          340|       loadModule = args: fallbackFile: fallbackKey: m:
             |                                                     ^
          341|         if isFunction m then

       … while evaluating call site

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:341:12:

          340|       loadModule = args: fallbackFile: fallbackKey: m:
          341|         if isFunction m then
             |            ^
          342|           unifyModuleSyntax fallbackFile fallbackKey (applyModuleArgs fallbackKey m args)

       … while calling 'isFunction'

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/trivial.nix:448:16:

          447|   */
          448|   isFunction = f: builtins.isFunction f ||
             |                ^
          449|     (f ? __functor && isFunction (f.__functor f));

       … while evaluating call site

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

       … while calling anonymous lambda

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:510:44:

          509|       context = name: ''while evaluating the module argument `${name}' in "${key}":'';
          510|       extraArgs = builtins.mapAttrs (name: _:
             |                                            ^
          511|         builtins.addErrorContext (context name)

       … while evaluating the module argument `flakes' in ":anon-5:anon-1":

       error: infinite recursion encountered

       at /nix/store/6kp2ql3nww07p270y2qfjpl4habskbkb-source/lib/modules.nix:512:28:

          511|         builtins.addErrorContext (context name)
          512|           (args.${name} or config._module.args.${name})
             |                            ^
          513|       ) (lib.functionArgs f);

I've tried without and with the "just NixOS" module installed. No difference

@GermanBread
Copy link
Owner

Hi. Unfortunately the trace is completely useless to me. I have no idea how to parse it.

Can you show me the value of the flakes function input?

By any chance: Are you overriding the nixpkgs input? Don't do that.

@nikp123
Copy link
Author

nikp123 commented Sep 21, 2023

Hi. Unfortunately the trace is completely useless to me. I have no idea how to parse it.

Can you show me the value of the flakes function input?

By any chance: Are you overriding the nixpkgs input? Don't do that.

Sure:
flake.nix

{
  inputs =  {
    # 23.05 stuff
    nixpkgs.url      = "github:nixos/nixpkgs/nixos-23.05";
    home-manager.url = "github:nix-community/home-manager/release-23.05";

    # Flatpak
    flatpak.url      = "github:GermanBread/declarative-flatpak/stable";

    # Unstable
    nixpkgs-unstable.url     = "github:nixos/nixpkgs/nixos-unstable";
    nur.url                  = "github:nix-community/NUR";

    # Custom
    rust-overlay.url         = "github:oxalica/rust-overlay";
    nix-psp.url              = "github:juliosueiras-nix/nix-psp";

    # Flake-utils
    flake-utils.url          = "github:numtide/flake-utils";

    # Erosanix
    erosanix = {
      inputs.nixpkgs.follows = "nixpkgs";
      url                    = "github:emmanuelrosa/erosanix";
    };

    # The securest of boots
    lanzaboote.url           = "github:nix-community/lanzaboote";
  };

  outputs = {
    self,
    nixpkgs,
    home-manager,
    nixpkgs-unstable,
    nur,
    flake-utils,
    rust-overlay,
    erosanix,
    lanzaboote,
    flatpak,
    nix-psp,
    ... }@inputs: (with flake-utils.lib; let
      packages = (final: import ./pkgs);
      overlays = [
        (final: prev: {
           unstable = import nixpkgs-unstable {
             system = "x86_64-linux";
             config.allowUnfree = true;
           };
        })
        nur.overlay
        (import rust-overlay)
      ] ++ import ./overlays;
    in {
    #nixosModules = import ./nixos self;
    #lib = import ./lib nixpkgs.lib;
    overlays            = overlays ++ [
      packages
    ];
    nixosConfigurations = import ./configurations.nix self; # this line is important
  }
...

configurations.nix

nikp123@NotThink ~> cat /etc/nixos/configurations.nix 
self:
with builtins;
let
  modules = hostname:
    [
      ./user/nikp123
      ./components/locale/en_US.nix
      ./components/kernels/zen.nix
      ./system/general/env/lightdm.nix
      ./devices/${hostname}
      ./modules
      {
        networking.hostName = hostname;
        nixpkgs.overlays = self.overlays;
      }
    ] ++ (with self.inputs.erosanix.nixosModules; [
      onlyoffice
      mkwindowsapp-gc
    ]);

  genericSystem = {
    system ? "x86_64-linux",
    extra_modules ? [],
  }: hostname: {
    ${hostname} = self.inputs.nixpkgs.lib.nixosSystem {
      system = system;
      modules = (modules hostname) ++ extra_modules;
      specialArgs = {
        flakes = self.inputs; # it goes here
      };
    };
  };

@nikp123
Copy link
Author

nikp123 commented Sep 21, 2023

sorry for the overbearing config i do have a lot going on

the folder size is nearly half a meg

@nikp123
Copy link
Author

nikp123 commented Sep 21, 2023

It's later referenced globally from the { flakes } input.

@GermanBread
Copy link
Owner

I'm extremely sorry, but I don't have the mental capacity to find the issue in either my module or your config.

It seems like it should work, but it doesn't.

Did you try the oldstable branch?

@nikp123
Copy link
Author

nikp123 commented Sep 21, 2023

I'm extremely sorry, but I don't have the mental capacity to find the issue in either my module or your config.

It seems like it should work, but it doesn't.

Did you try the oldstable branch?

I didn't but I can, thanks for the tip.

Don't worry about it. I'm just letting you know about it. You don't have to fix it if you don't want to.

@GermanBread
Copy link
Owner

I didn't but I can, thanks for the tip.

If you can get that to import then I have to do a bit of digging.

The old-stable branch isn't really meant to be used by anyone except people who hate breaking changes...


Slightly Offtopic:

I'm sorry if this sounds rude, but I'm currently very occupied with my job and every day I come back home exhausted.

I don't have much free time and I'd rather use it for recreational purposes.

I will still try my best to prevent this module from blowing up ... and it seems like it is robust enough when you actually get to import it.

@nikp123
Copy link
Author

nikp123 commented Sep 21, 2023

I didn't but I can, thanks for the tip.

If you can get that to import then I have to do a bit of digging.

The old-stable branch isn't really meant to be used by anyone except people who hate breaking changes...

Slightly Offtopic:

I'm sorry if this sounds rude, but I'm currently very occupied with my job and every day I come back home exhausted.

I don't have much free time and I'd rather use it for recreational purposes.

I will still try my best to prevent this module from blowing up ... and it seems like it is robust enough when you actually get to import it.

It's alright, as I said. Keep time for yourself. It's all voluntary work here on GitHub. If you won't fix it I'll find some way else to fix it or abandon it. I hope you're doing well atm.

@GermanBread
Copy link
Owner

I hope you're doing well atm.

I'm doing well, all things considered. Thanks for asking.

Lmk if you found out anything!

@nikp123
Copy link
Author

nikp123 commented Sep 21, 2023

I hope you're doing well atm.

I'm doing well, all things considered. Thanks for asking.

Lmk if you found out anything!

I will, thanks

@nikp123
Copy link
Author

nikp123 commented Sep 21, 2023

Nope, it seems that it has the same issue even with the old-stable branch.

@nikp123
Copy link
Author

nikp123 commented Sep 22, 2023

Not even the dev branch unfortunately.

@bayazidbh
Copy link

bayazidbh commented Sep 30, 2023

Having the same issue:

Output

$ home-manager switch -b bak
error:
       … while evaluating a branch condition

         at /nix/store/sd160y3xyy80h9y1kdy7566fnw4pn5f3-source/lib/lists.nix:57:9:

           56|       fold' = n:
           57|         if n == len
             |         ^
           58|         then nulwhile calling the 'length' builtin

         at /nix/store/sd160y3xyy80h9y1kdy7566fnw4pn5f3-source/lib/lists.nix:55:13:

           54|     let
           55|       len = length list;
             |             ^
           56|       fold' = n:

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

       error: attribute 'nixosConfig' missing

       at /nix/store/sd160y3xyy80h9y1kdy7566fnw4pn5f3-source/lib/modules.nix:506:28:

          505|         builtins.addErrorContext (context name)
          506|           (args.${name} or config._module.args.${name})
             |                            ^
          507|       ) (lib.functionArgs f);

I checked that I could build fine without declarative-flatpak being turned on, so must be this issue? Here is my flakes at the moment:

flake

Currently building mainly for laptop:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; # use nixpkgs-unstable as main nixpkgs source
    home-manager = {
      url = "github:nix-community/home-manager"; # home-manager unstable url
      inputs.nixpkgs.follows = "nixpkgs"; # inherit nixpkgs-unstable as main nixpkgs source
    };
    flatpaks.url = "github:GermanBread/declarative-flatpak/stable"; # declarative-flatpak, still WIP
    nixgl.url = "github:guibou/nixGL"; # nixGL for running Wine
    chaotic.url = "github:chaotic-cx/nyx/nyxpkgs-unstable"; # https://github.com/chaotic-cx/nyx#how-to-use-it}
    # Add other inputs if needed
  };

  outputs = { self, nixpkgs, home-manager, flatpaks, nixgl, chaotic }:
  let

    # System types to support.  [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
    supportedSystems = [ "x86_64-linux" ];
    # Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
    forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
    # Nixpkgs instantiated for supported system types.
    nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });

  in
  {
    # Standalone home-manager configuration entrypoint
    homeConfigurations = {
    # declare a "username" or "username@hostname" specific configuration
      "fenglengshun@bbh-pc" = home-manager.lib.homeManagerConfiguration {
        pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
        extraSpecialArgs = { inherit nixgl; }; # so that home-manager can correctly read nixgl packages
        modules = [
          ./home.nix # default home.nix
          ./default/shell.nix # shell config for all devices
          ./default/env.nix # env-var for all devices
          ./default/alias.nix # aliases for all devices
          ./default/files.nix # file creation for all devices
          ./default/autostart.nix # autostart with systemctl
          ./pc/by-device.nix # device specific configs
          ./pc/autostart.nix # device specific autostart
          ./pc/flatpak.nix # separate list for flatpak
          # ./pc/chaotic.nix # separate list for chaotic.nix package
          ./pc/nixgl.nix # separate list for nixgl.nix package
          flatpaks.homeManagerModules.default # declarative-flatpak HM module
          # chaotic.homeManagerModules.default # chaotic nyx HM module
        ];
      };
      "fenglengshun@bbh-laptop" = home-manager.lib.homeManagerConfiguration {
        pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
        # extraSpecialArgs = { inherit nixgl; }; # so that home-manager can correctly read nixgl packages
        modules = [
          ./home.nix # default home.nix
          ./default/shell.nix # shell config for all devices
          ./default/env.nix # env-var for all devices
          ./default/alias.nix # aliases for all devices
          ./default/files.nix # file creation for all devices
          ./default/autostart.nix # autostart with systemctl
          ./laptop/by-device.nix # device specific configs
          ./laptop/autostart.nix # device specific autostart
          ./laptop/flatpak.nix # separate list for flatpak
          flatpaks.homeManagerModules.default # import declarative-flatpak module
        ];
      };
      "root" = home-manager.lib.homeManagerConfiguration {
        pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
        modules = [
          ./root/home.nix # default home.nix
          ./default/shell.nix # shell config for all devices
        ];
      };
    };
  };
}

flatpak.nix

{ config, pkgs, ... }:
{
  services.flatpak = {
    remotes = {
      "flathub" = "https://dl.flathub.org/repo/flathub.flatpakrepo";
      "launcher-moe" = "https://gol.launcher.moe/gol.launcher.moe.flatpakrepo";
    };
    packages = [
     "flathub:com.github.tchx84.Flatseal/x86_64/stable"
     "flathub:com.steamgriddb.SGDBoop/x86_64/stable"
     "flathub:com.stremio.Stremio/x86_64/stable"
     "flathub:com.usebottles.bottles/x86_64/stable"
     "flathub:com.wps.Office/x86_64/stable"
     "flathub:io.github.Foldex.AdwSteamGtk/x86_64/stable"
     "flathub:io.github.aandrew_me.ytdn/x86_64/stable"
     "flathub:io.wavebox.Wavebox/x86_64/stable"
     "flathub:net.codeindustry.MasterPDFEditor/x86_64/stable"
     "flathub:net.cozic.joplin_desktop/x86_64/stable"
     "flathub:org.upscayl.Upscayl/x86_64/stable"
     "flathub:org.videolan.VLC/x86_64/stable"
     "flathub:page.codeberg.Imaginer.Imaginer/x86_64/stable"
     "flathub:io.github.Bavarder.Bavarder/x86_64/stable"
     "launcher-moe:moe.launcher.the-honkers-railway-launcher/x86_64/master"
     "flathub:org.freedesktop.Platform.VulkanLayer.gamescope/x86_64/23.08"
     "flathub:com.valvesoftware.Steam.Utility.gamescope/x86_64/stable"
     "flathub:org.freedesktop.Platform.VulkanLayer.MangoHud/x86_64/23.08"
     "flathub:com.obsproject.Studio/x86_64/stable"
     "flathub:org.freedesktop.Platform.VulkanLayer.OBSVkCapture/x86_64/23.08"
     "flathub:com.obsproject.Studio.Plugin.OBSVkCapture/x86_64/stable"
     "flathub:com.obsproject.Studio.Plugin.Gstreamer/x86_64/stable"
     "flathub:com.obsproject.Studio.Plugin.GStreamerVaapi/x86_64/stable"
     "flathub:com.obsproject.Studio.Plugin.DroidCam/x86_64/stable"
     "flathub:com.obsproject.Studio.Plugin.BackgroundRemoval/x86_64/stable"
    ];
    postInitCommand = "/usr/bin/ln -sifv ${config.xdg.configHome}/home-manager/flatpak/overrides ${config.xdg.dataHome}/flatpak/";
  };

}

Not painfully emergency, for now I could still use the existing flatpak flake I have to just find-and-replace to then install through Kate pipe to Konsole. So take your time, and hope you're doing well.

@GermanBread
Copy link
Owner

GermanBread commented Sep 30, 2023

error: attribute 'nixosConfig' missing

Hmm. This should be populated when you use home-manager as a NixOS module.

And it should also fall back to null. Weird.

Here is the relevant code snippet

{ config, lib, pkgs, nixosConfig ? null, ... }:

let
  cfg = if nixosConfig == null then config.services.flatpak else config.services.flatpak // { enable = nixosConfig.services.flatpak.enable; };
in 

Oh wait, maybe it needs parentheses. The // operator might be applying to the whole thing.

@bayazidbh
Copy link

Just in case, here's a link to gist for the lists and modules log files in the Output

@GermanBread
Copy link
Owner

Try using the module now

@bayazidbh
Copy link

bayazidbh commented Sep 30, 2023

Sorry, still the same:

Output

nix flake update
warning: updating lock file '/var/home/fenglengshun/.config/home-manager/flake.lock':
• Updated input 'flatpaks':
    'github:GermanBread/declarative-flatpak/45765957e396e7a2029122f392bfd1272724e626' (2023-09-25)
  → 'github:GermanBread/declarative-flatpak/ee849b0939a75b0d602b89c3d9fca2919cb009b8' (2023-09-30)Updated input 'flatpaks/nixpkgs':
    'github:NixOS/nixpkgs/360a7d31c30abefdc490d203f80e3221b7a24af2' (2023-09-15)
  → 'github:NixOS/nixpkgs/5cfafa12d57374f48bcc36fda3274ada276cf69e' (2023-09-27)
warning: Git tree '/var/home/fenglengshun/.config/home-manager' is dirtykate ./flake.nixhome-manager switch -b bak
error:
       … while evaluating a branch condition

         at /nix/store/sd160y3xyy80h9y1kdy7566fnw4pn5f3-source/lib/lists.nix:57:9:

           56|       fold' = n:
           57|         if n == len
             |         ^
           58|         then nulwhile calling the 'length' builtin

         at /nix/store/sd160y3xyy80h9y1kdy7566fnw4pn5f3-source/lib/lists.nix:55:13:

           54|     let
           55|       len = length list;
             |             ^
           56|       fold' = n:

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

       error: attribute 'nixosConfig' missing

       at /nix/store/sd160y3xyy80h9y1kdy7566fnw4pn5f3-source/lib/modules.nix:506:28:

          505|         builtins.addErrorContext (context name)
          506|           (args.${name} or config._module.args.${name})
             |                            ^
          507|       ) (lib.functionArgs f);sudo nix-channel --update ; nix-channel --update ; nix flake update
[sudo] password for fenglengshun: 
unpacking channels...
unpacking channels...
warning: Git tree '/var/home/fenglengshun/.config/home-manager' is dirtyhome-manager switch -b bak
error: cached failure of attribute 'homeConfigurations.fenglengshun@bbh-laptop.activationPackage'home-manager switch       
error: cached failure of attribute 'homeConfigurations.fenglengshun@bbh-laptop.activationPackage'home-manager switch -b bak
error:
       … while evaluating a branch condition

         at /nix/store/sd160y3xyy80h9y1kdy7566fnw4pn5f3-source/lib/lists.nix:57:9:

           56|       fold' = n:
           57|         if n == len
             |         ^
           58|         then nulwhile calling the 'length' builtin

         at /nix/store/sd160y3xyy80h9y1kdy7566fnw4pn5f3-source/lib/lists.nix:55:13:

           54|     let
           55|       len = length list;
             |             ^
           56|       fold' = n:

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

       error: attribute 'nixosConfig' missing

       at /nix/store/sd160y3xyy80h9y1kdy7566fnw4pn5f3-source/lib/modules.nix:506:28:

          505|         builtins.addErrorContext (context name)
          506|           (args.${name} or config._module.args.${name})
             |                            ^
          507|       ) (lib.functionArgs f);

Please tell me if I'm doing anything wrong, as I'm still a flakes newbie here.....

Edit: wait, I should probably switch to Dev branch right?

Edit2: nvm, still the same issue on both dev and stable

@nikp123
Copy link
Author

nikp123 commented Nov 9, 2023

@bayazidbh Found out what's going on, turns out it's a bug in Home-Manager (likely).

You MUST keep the import where you included your home manager module, ie:

{ pkgs, flakes, ... }: {
  imports = [
    flakes.home-manager.nixosModule
  ];
  home-manager.users.nikp123 = {
    imports = [
       // MUST BE INCLUDED HERE
    ];
  };
}

Doing this instead will break the module:

  home-manager.users.nikp123 = import ./home.nix

and in home.nix

{ pkgs, flakes, ... }: {
   imports = [
     // dont include here
   ];
}

Relevant issue: nix-community/nixvim#83

@nikp123 nikp123 changed the title Home-Manager module seems to be broken Home-Manager module breaks when not included in the same place as home-manager itself Nov 9, 2023
@nikp123
Copy link
Author

nikp123 commented Nov 9, 2023

For now I think a warning would suffice, because it seems that home-manager has weird breakages depending on how you write your config.

@GermanBread
Copy link
Owner

Oh that's interesting!

Thanks for figuring that out. I assumed that both would work. I guess not.

I will fix the documentation when I get back home.

@nikp123
Copy link
Author

nikp123 commented Nov 9, 2023

took me long enough

@bayazidbh
Copy link

@nikp123 Okay, though I'm not importing the module in home.nix, so I'm not sure what I'm doing wrong here.

Testing this on my laptop, here's my flake.nix home.nix and flatpaks-dev.nix files which should be all that's relevant.

Output

home-manager switch -b bak
error:
       … while evaluating a branch condition

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/lists.nix:57:9:

           56|       fold' = n:
           57|         if n == len
             |         ^
           58|         then nul

       … while calling the 'length' builtin

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/lists.nix:55:13:

           54|     let
           55|       len = length list;
             |             ^
           56|       fold' = n:

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

       error: attribute 'nixosConfig' missing

       at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/modules.nix:506:28:

          505|         builtins.addErrorContext (context name)
          506|           (args.${name} or config._module.args.${name})
             |                            ^
          507|       ) (lib.functionArgs f);

@GermanBread
Copy link
Owner

You might have to put the module import at the very beginning

@GermanBread
Copy link
Owner

I'm honestly confused why hm tries to populate the nixosConfig parameter if it's optional...

@GermanBread
Copy link
Owner

@bayazidbh Ookay so I pushed something to dev. Try using that.

@GermanBread GermanBread reopened this Nov 10, 2023
@bayazidbh
Copy link

bayazidbh commented Nov 10, 2023

Still failed unfortunately, but it has a different error message now. Here's the output:

Details

$ home-manager switch -b bak
error (ignored): error: reached end of FramedSource
error:
       … while fetching the input 'path:/var/home/fenglengshun/.config/home-manager'

       error: getting status of '/var/home/fenglengshun/.config/home-manager/flake.nix~20231110_172740.kate-bak': No such file or directory
error:
       … while evaluating a branch condition

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/lists.nix:57:9:

           56|       fold' = n:
           57|         if n == len
             |         ^
           58|         then nulwhile calling the 'length' builtin

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/lists.nix:55:13:

           54|     let
           55|       len = length list;
             |             ^
           56|       fold' = n:

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

       error: attribute 'enable' missing

       at /nix/store/8z4k87gv08gfjsqsw32l52k5i805q4dq-source/src/options.nix:21:15:

           20|     type = types.bool;
           21|     default = cfg.enable;
             |               ^
           22|     description = mdDoc ''

$ home-manager switch -b bak --show-trace                               
error:
       … from call site

         at /nix/store/nn718rqcsrx9ag8kligmfghdqqh5bick-source/modules/default.nix:39:12:

           38|
           39|   module = showWarnings (
             |            ^
           40|     let

       … while calling 'showWarnings'

         at /nix/store/nn718rqcsrx9ag8kligmfghdqqh5bick-source/modules/default.nix:18:18:

           17|
           18|   showWarnings = res:
             |                  ^
           19|     let

       … from call site

         at /nix/store/nn718rqcsrx9ag8kligmfghdqqh5bick-source/modules/default.nix:22:7:

           21|     in
           22|       fold f res res.config.warnings;
             |       ^
           23|

       … while calling 'foldr'

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/lists.nix:53:20:

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

       … from call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/lists.nix:60:8:

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

       … while calling 'fold''

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/lists.nix:56:15:

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

         at /nix/store/nn718rqcsrx9ag8kligmfghdqqh5bick-source/modules/default.nix:41:16:

           40|     let
           41|       failed = collectFailed rawModule.config;
             |                ^
           42|       failedStr = concatStringsSep "\n" (map (x: "- ${x}") failed);while calling 'collectFailed'

         at /nix/store/nn718rqcsrx9ag8kligmfghdqqh5bick-source/modules/default.nix:15:19:

           14|
           15|   collectFailed = cfg:
             |                   ^
           16|     map (x: x.message) (filter (x: !x.assertion) cfg.assertions);while evaluating the error message for definitions for `services.flatpak.flatpak', which is an option that does not existwhile evaluating a definition from `/nix/store/sn2ydvv8pxb1m476iyw93khiqfnjb24b-source/laptop/flatpaks-dev.nix'

       … from call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/modules.nix:272:25:

          271|                       "while evaluating a definition from `${firstDef.file}'"
          272|                       ( showDefs [ firstDef ])
             |                         ^
          273|                     );while calling 'showDefs'

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/options.nix:427:14:

          426|
          427|   showDefs = defs: concatMapStrings (def:
             |              ^
          428|     letfrom call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/options.nix:427:20:

          426|
          427|   showDefs = defs: concatMapStrings (def:
             |                    ^
          428|     letwhile calling 'concatMapStrings'

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/strings.nix:60:25:

           59|   */
           60|   concatMapStrings = f: list: concatStrings (map f list);
             |                         ^
           61|

       … while calling anonymous lambda

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/options.nix:427:38:

          426|
          427|   showDefs = defs: concatMapStrings (def:
             |                                      ^
          428|     letfrom call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/options.nix:431:10:

          430|       prettyEval = builtins.tryEval
          431|         (lib.generators.toPretty { }
             |          ^
          432|           (lib.generators.withRecursion { depthLimit = 10; throwOnDepthLimit = false; } def.value));while calling 'go'

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/generators.nix:314:18:

          313|     let
          314|     go = indent: v: with builtins;
             |                  ^
          315|     let     isPath   = v: typeOf v == "path";while calling anonymous lambda

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/attrsets.nix:543:10:

          542|     attrs:
          543|     map (name: f name attrs.${name}) (attrNames attrs);
             |          ^
          544|

       … from call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/attrsets.nix:543:16:

          542|     attrs:
          543|     map (name: f name attrs.${name}) (attrNames attrs);
             |                ^
          544|

       … while calling anonymous lambda

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/generators.nix:363:22:

          362|           + libStr.concatStringsSep introSpace (libAttr.mapAttrsToList
          363|               (name: value:
             |                      ^
          364|                 "${libStr.escapeNixIdentifier name} = ${

while evaluating an attribute `postInitCommand`

from call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/generators.nix:366:22:

          365|                   builtins.addErrorContext "while evaluating an attribute `${name}`"
          366|                     (go (indent + "  ") value)
             |                      ^
          367|                 };") v)while calling 'go'

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/generators.nix:314:18:

          313|     let
          314|     go = indent: v: with builtins;
             |                  ^
          315|     let     isPath   = v: typeOf v == "path";while calling 'evalNext'

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/generators.nix:289:24:

          288|           let
          289|             evalNext = x: mapAny (depth + 1) (transform (depth + 1) x);
             |                        ^
          290|           infrom call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/generators.nix:289:27:

          288|           let
          289|             evalNext = x: mapAny (depth + 1) (transform (depth + 1) x);
             |                           ^
          290|           inwhile calling anonymous lambda

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/generators.nix:287:40:

          286|           else id;
          287|         mapAny = with builtins; depth: v:
             |                                        ^
          288|           letfrom call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/generators.nix:289:47:

          288|           let
          289|             evalNext = x: mapAny (depth + 1) (transform (depth + 1) x);
             |                                               ^
          290|           inwhile calling 'id'

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/trivial.nix:14:5:

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

       … while calling 'g'

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/attrsets.nix:629:19:

          628|           g =
          629|             name: value:
             |                   ^
          630|             if isAttrs value && cond valuefrom call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/attrsets.nix:632:20:

          631|               then recurse (path ++ [name]) value
          632|               else f (path ++ [name]) value;
             |                    ^
          633|         in mapAttrs g;while calling anonymous lambda

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

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

       … while evaluating the option `xdg.configHome':

       … while calling anonymous lambda

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/modules.nix:822:28:

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

       … from call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/modules.nix:823:137:

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

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/modules.nix:894:25:

          893|   */
          894|   dischargeProperties = def:
             |                         ^
          895|     if def._type or "" == "merge" thenwhile calling 'g'

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/attrsets.nix:629:19:

          628|           g =
          629|             name: value:
             |                   ^
          630|             if isAttrs value && cond valuefrom call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/attrsets.nix:632:20:

          631|               then recurse (path ++ [name]) value
          632|               else f (path ++ [name]) value;
             |                    ^
          633|         in mapAttrs g;while calling anonymous lambda

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

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

       … while evaluating the option `xdg.enable':

       … while calling anonymous lambda

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/modules.nix:822:28:

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

       … from call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/modules.nix:823:137:

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

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/modules.nix:894:25:

          893|   */
          894|   dischargeProperties = def:
             |                         ^
          895|     if def._type or "" == "merge" thenwhile calling 'g'

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/attrsets.nix:629:19:

          628|           g =
          629|             name: value:
             |                   ^
          630|             if isAttrs value && cond valuefrom call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/attrsets.nix:632:20:

          631|               then recurse (path ++ [name]) value
          632|               else f (path ++ [name]) value;
             |                    ^
          633|         in mapAttrs g;while calling anonymous lambda

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

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

       … while evaluating the option `services.flatpak.enableModule':

       … while calling anonymous lambda

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/modules.nix:832:19:

          831|           # Avoid sorting if we don't have to.
          832|           if any (def: def.value._type or "" == "order") defs''.values
             |                   ^
          833|           then sortProperties defs''.values

       error: attribute 'enable' missing

       at /nix/store/8z4k87gv08gfjsqsw32l52k5i805q4dq-source/src/options.nix:21:15:

           20|     type = types.bool;
           21|     default = cfg.enable;
             |               ^
           22|     description = mdDoc ''

Looks like an issue with the enable option? I've tried both

services.flatpak.flatpak = {
  enable = true;
config.services.flatpak.flatpak = {
  enable = true;

as well as omitting it like in the flatpak stable file.

Edit: wait, it's enableModule, hold on lemme try that.

Edit 2: Nope, doesn't work either... I'm starting to feel bad due to how much problem I'm posting here

Details

$ home-manager switch -b bak                                       
error:
       … while evaluating a branch condition

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/lists.nix:57:9:

           56|       fold' = n:
           57|         if n == len
             |         ^
           58|         then nulwhile calling the 'length' builtin

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/lists.nix:55:13:

           54|     let
           55|       len = length list;
             |             ^
           56|       fold' = n:

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

       error: attribute 'enable' missing

       at /nix/store/8z4k87gv08gfjsqsw32l52k5i805q4dq-source/src/options.nix:21:15:

           20|     type = types.bool;
           21|     default = cfg.enable;
             |               ^
           22|     description = mdDoc ''

$ home-manager switch -b bak --show-trace
error:
       … from call site

         at /nix/store/nn718rqcsrx9ag8kligmfghdqqh5bick-source/modules/default.nix:39:12:

           38|
           39|   module = showWarnings (
             |            ^
           40|     let

       … while calling 'showWarnings'

         at /nix/store/nn718rqcsrx9ag8kligmfghdqqh5bick-source/modules/default.nix:18:18:

           17|
           18|   showWarnings = res:
             |                  ^
           19|     let

       … from call site

         at /nix/store/nn718rqcsrx9ag8kligmfghdqqh5bick-source/modules/default.nix:22:7:

           21|     in
           22|       fold f res res.config.warnings;
             |       ^
           23|

       … while calling 'foldr'

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/lists.nix:53:20:

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

       … from call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/lists.nix:60:8:

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

       … while calling 'fold''

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/lists.nix:56:15:

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

         at /nix/store/nn718rqcsrx9ag8kligmfghdqqh5bick-source/modules/default.nix:41:16:

           40|     let
           41|       failed = collectFailed rawModule.config;
             |                ^
           42|       failedStr = concatStringsSep "\n" (map (x: "- ${x}") failed);while calling 'collectFailed'

         at /nix/store/nn718rqcsrx9ag8kligmfghdqqh5bick-source/modules/default.nix:15:19:

           14|
           15|   collectFailed = cfg:
             |                   ^
           16|     map (x: x.message) (filter (x: !x.assertion) cfg.assertions);while evaluating the error message for definitions for `services.flatpak.flatpak', which is an option that does not existwhile evaluating a definition from `/nix/store/484lan62v5xmx8346p5w93qsnb7rwg3h-source/laptop/flatpaks-dev.nix'

       … from call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/modules.nix:272:25:

          271|                       "while evaluating a definition from `${firstDef.file}'"
          272|                       ( showDefs [ firstDef ])
             |                         ^
          273|                     );while calling 'showDefs'

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/options.nix:427:14:

          426|
          427|   showDefs = defs: concatMapStrings (def:
             |              ^
          428|     letfrom call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/options.nix:427:20:

          426|
          427|   showDefs = defs: concatMapStrings (def:
             |                    ^
          428|     letwhile calling 'concatMapStrings'

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/strings.nix:60:25:

           59|   */
           60|   concatMapStrings = f: list: concatStrings (map f list);
             |                         ^
           61|

       … while calling anonymous lambda

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/options.nix:427:38:

          426|
          427|   showDefs = defs: concatMapStrings (def:
             |                                      ^
          428|     letfrom call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/options.nix:431:10:

          430|       prettyEval = builtins.tryEval
          431|         (lib.generators.toPretty { }
             |          ^
          432|           (lib.generators.withRecursion { depthLimit = 10; throwOnDepthLimit = false; } def.value));while calling 'go'

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/generators.nix:314:18:

          313|     let
          314|     go = indent: v: with builtins;
             |                  ^
          315|     let     isPath   = v: typeOf v == "path";while calling anonymous lambda

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/attrsets.nix:543:10:

          542|     attrs:
          543|     map (name: f name attrs.${name}) (attrNames attrs);
             |          ^
          544|

       … from call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/attrsets.nix:543:16:

          542|     attrs:
          543|     map (name: f name attrs.${name}) (attrNames attrs);
             |                ^
          544|

       … while calling anonymous lambda

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/generators.nix:363:22:

          362|           + libStr.concatStringsSep introSpace (libAttr.mapAttrsToList
          363|               (name: value:
             |                      ^
          364|                 "${libStr.escapeNixIdentifier name} = ${

while evaluating an attribute `postInitCommand`

from call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/generators.nix:366:22:

          365|                   builtins.addErrorContext "while evaluating an attribute `${name}`"
          366|                     (go (indent + "  ") value)
             |                      ^
          367|                 };") v)while calling 'go'

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/generators.nix:314:18:

          313|     let
          314|     go = indent: v: with builtins;
             |                  ^
          315|     let     isPath   = v: typeOf v == "path";while calling 'evalNext'

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/generators.nix:289:24:

          288|           let
          289|             evalNext = x: mapAny (depth + 1) (transform (depth + 1) x);
             |                        ^
          290|           infrom call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/generators.nix:289:27:

          288|           let
          289|             evalNext = x: mapAny (depth + 1) (transform (depth + 1) x);
             |                           ^
          290|           inwhile calling anonymous lambda

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/generators.nix:287:40:

          286|           else id;
          287|         mapAny = with builtins; depth: v:
             |                                        ^
          288|           letfrom call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/generators.nix:289:47:

          288|           let
          289|             evalNext = x: mapAny (depth + 1) (transform (depth + 1) x);
             |                                               ^
          290|           inwhile calling 'id'

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/trivial.nix:14:5:

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

       … while calling 'g'

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/attrsets.nix:629:19:

          628|           g =
          629|             name: value:
             |                   ^
          630|             if isAttrs value && cond valuefrom call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/attrsets.nix:632:20:

          631|               then recurse (path ++ [name]) value
          632|               else f (path ++ [name]) value;
             |                    ^
          633|         in mapAttrs g;while calling anonymous lambda

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

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

       … while evaluating the option `xdg.configHome':

       … while calling anonymous lambda

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/modules.nix:822:28:

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

       … from call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/modules.nix:823:137:

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

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/modules.nix:894:25:

          893|   */
          894|   dischargeProperties = def:
             |                         ^
          895|     if def._type or "" == "merge" thenwhile calling 'g'

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/attrsets.nix:629:19:

          628|           g =
          629|             name: value:
             |                   ^
          630|             if isAttrs value && cond valuefrom call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/attrsets.nix:632:20:

          631|               then recurse (path ++ [name]) value
          632|               else f (path ++ [name]) value;
             |                    ^
          633|         in mapAttrs g;while calling anonymous lambda

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

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

       … while evaluating the option `xdg.enable':

       … while calling anonymous lambda

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/modules.nix:822:28:

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

       … from call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/modules.nix:823:137:

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

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/modules.nix:894:25:

          893|   */
          894|   dischargeProperties = def:
             |                         ^
          895|     if def._type or "" == "merge" thenwhile calling 'g'

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/attrsets.nix:629:19:

          628|           g =
          629|             name: value:
             |                   ^
          630|             if isAttrs value && cond valuefrom call site

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/attrsets.nix:632:20:

          631|               then recurse (path ++ [name]) value
          632|               else f (path ++ [name]) value;
             |                    ^
          633|         in mapAttrs g;while calling anonymous lambda

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

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

       … while evaluating the option `services.flatpak.enableModule':

       … while calling anonymous lambda

         at /nix/store/mj0hy52z22q5gpsf33akndxiclxd8ray-source/lib/modules.nix:832:19:

          831|           # Avoid sorting if we don't have to.
          832|           if any (def: def.value._type or "" == "order") defs''.values
             |                   ^
          833|           then sortProperties defs''.values

       error: attribute 'enable' missing

       at /nix/store/8z4k87gv08gfjsqsw32l52k5i805q4dq-source/src/options.nix:21:15:

           20|     type = types.bool;
           21|     default = cfg.enable;
             |               ^
           22|     description = mdDoc ''

@GermanBread
Copy link
Owner

I tested it on using hm standalone on NixOS and non-NixOS. Both work without nixosConfig being populated.

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