Home-manager configuration suddently fails to build

I didn’t change anything about my home manager configuration, but excluding it from my configuration.nix fixes the error.
Here is my nixos configuration.

$ sudo nixos-rebuild test --show-trace
building Nix...
building the system configuration...
error: 'submoduleWith' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:570:7 called with unexpected argument 'description'

       at /nix/store/qjf1lmr86z38gg5npfhrvklab7gj9gn8-source/nixos/common.nix:14:14:

           13|
           14|   hmModule = types.submoduleWith {
             |              ^
           15|     description = "Home Manager module";

       … while evaluating the attribute 'type.getSubModules'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:160:14:

          159|     { _type = "option-type";
          160|       inherit name check merge emptyValue getSubOptions getSubModules substSubModules typeMerge functor deprecationMessage nestedTypes;
             |              ^
          161|       description = if description == null then name else description;

       … while evaluating 'fixupOptionType'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:893:26:

          892|   # TODO: Merge this into mergeOptionDecls
          893|   fixupOptionType = loc: opt:
             |                          ^
          894|     if opt.type.getSubModules or null == null

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:609:23:

          608|           if length optionDecls == length decls then
          609|             let opt = fixupOptionType loc (mergeOptionDecls loc decls);
             |                       ^
          610|             in {

       … while evaluating 'warnIf'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/trivial.nix:350:18:

          349|   */
          350|   warnIf = cond: msg: if cond then warn msg else x: x;
             |                  ^
          351|

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:742:9:

          741|       warnDeprecation =
          742|         warnIf (opt.type.deprecationMessage != null)
             |         ^
          743|           "The type `types.${opt.type.name}' of option `${showOption loc}' defined in ${showFiles opt.declarations} is deprecated. ${opt.type.deprecationMessage}";

       … while evaluating 'evalOptionValue'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:717:31:

          716|      config value. */
          717|   evalOptionValue = loc: opt: defs:
             |                               ^
          718|     let

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:611:32:

          610|             in {
          611|               matchedOptions = evalOptionValue loc opt defns';
             |                                ^
          612|               unmatchedDefns = [];

       … while evaluating the attribute 'matchedOptions'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:611:15:

          610|             in {
          611|               matchedOptions = evalOptionValue loc opt defns';
             |               ^
          612|               unmatchedDefns = [];

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:642:37:

          641|
          642|       matchedOptions = mapAttrs (n: v: v.matchedOptions) resultsByName;
             |                                     ^
          643|

       … from call site

       … while evaluating 'g'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:398:19:

          397|           g =
          398|             name: value:
             |                   ^
          399|             if isAttrs value && cond value

       … from call site

       … while evaluating the attribute 'condition'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:903:14:

          902|     { _type = "if";
          903|       inherit condition content;
             |              ^
          904|     };

       … while evaluating the attribute 'condition'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:903:14:

          902|     { _type = "if";
          903|       inherit condition content;
             |              ^
          904|     };

       … while evaluating 'dischargeProperties'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:832:25:

          831|   */
          832|   dischargeProperties = def:
             |                         ^
          833|     if def._type or "" == "merge" then

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:761:137:

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

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

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:760:28:

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

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:760:17:

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

       … while evaluating the attribute 'values'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:873:7:

          872|     in {
          873|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
             |       ^
          874|       inherit highestPrio;

       … while evaluating the attribute 'values'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:774:9:

          773|       in {
          774|         values = defs''';
             |         ^
          775|         inherit (defs'') highestPrio;

       … while evaluating the attribute 'mergedValue'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:780:5:

          779|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
          780|     mergedValue =
             |     ^
          781|       if isDefined then

       … while evaluating the option `assertions':

       … while evaluating the attribute 'value'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:746:9:

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

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:296:72:

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

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:401:20:

          400|               then recurse (path ++ [name]) value
          401|               else f (path ++ [name]) value;
             |                    ^
          402|         in mapAttrs g;

       … while evaluating 'g'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:398:19:

          397|           g =
          398|             name: value:
             |                   ^
          399|             if isAttrs value && cond value

       … from call site

       … while evaluating 'fold'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:56:15:

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

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:60:8:

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

       … while evaluating 'foldr'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:53:20:

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

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/top-level.nix:139:12:

          138|   # Replace runtime dependencies
          139|   system = foldr ({ oldDependency, newDependency }: drv:
             |            ^
          140|       pkgs.replaceDependency { inherit oldDependency newDependency drv; }

       … while evaluating the attribute 'value'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:581:44:

          580|       defnsByName' = byName "config" (module: value:
          581|           [{ inherit (module) file; inherit value; }]
             |                                            ^
          582|         ) configs;

       … while evaluating 'dischargeProperties'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:832:25:

          831|   */
          832|   dischargeProperties = def:
             |                         ^
          833|     if def._type or "" == "merge" then

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:761:137:

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

       … while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/top-level.nix':

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:760:28:

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

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:760:17:

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

       … while evaluating the attribute 'values'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:873:7:

          872|     in {
          873|       values = concatMap (def: if getPrio def == highestPrio then [(strip def)] else []) defs;
             |       ^
          874|       inherit highestPrio;

       … while evaluating the attribute 'values'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:774:9:

          773|       in {
          774|         values = defs''';
             |         ^
          775|         inherit (defs'') highestPrio;

       … while evaluating the attribute 'mergedValue'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:780:5:

          779|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
          780|     mergedValue =
             |     ^
          781|       if isDefined then

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

       … while evaluating the attribute 'value'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:746:9:

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

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:296:72:

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

       … from call site

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:401:20:

          400|               then recurse (path ++ [name]) value
          401|               else f (path ++ [name]) value;
             |                    ^
          402|         in mapAttrs g;

       … while evaluating 'g'

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:398:19:

          397|           g =
          398|             name: value:
             |                   ^
          399|             if isAttrs value && cond value

       … from call site

       … while evaluating anonymous lambda

       at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:518:24:

          517|     let f = attrPath:
          518|       zipAttrsWith (n: values:
             |                        ^
          519|         let here = attrPath ++ [n]; in

       … from call site

Errors like this are usually due to a mismatch in channels.

So what are the channels you build your system from?

1 Like

I used the 22.05 NixOS channel and the master home-manager channel, if I correctly understand what a channel is…
I changed the home-manager channel to 22.05 now, and it works again. Thanks! :smile:

2 Likes

How would you go about ensuring they are on the same channel with flakes? I currently have my flake inputs set to

inputs = {
    nixpkgs = {
      url = "github:nixos/nixpkgs/nixos-22.05";
    };
    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

and both the home-manager and NixOS stateVersion set to 22.05

On nixos-rebuild switch I get:

error: 'submoduleWith' at /nix/store/2cdl5b0l52645wr7f0sg29rhd8cbn2w8-source/lib/types.nix:570:7 called with unexpected argument 'description'

       at /nix/store/abc8vjmpyi0yc69yxrpzvksw6f9nh5vd-source/nixos/common.nix:14:14:

           13|
           14|   hmModule = types.submoduleWith {
             |              ^
           15|     description = "Home Manager module";
(use '--show-trace' to show detailed location information)

nixpkgs is at commit f0fa012b649a47e408291e96a15672a4fe925d65 and home-manager at dbed4c794d20d51027fc1107f063ec5be027dafc

Your HM is from master, therefore made for nixos-unstable, you need to use the release-22.05 branch of home manager.

2 Likes

Oh, I see. Changed to github:nixos/nixpkgs/nixos-unstable and it works like a charm now.
Thanks!:smiley:

Just to clarify, in case you’re having a common misunderstanding: stateVersion has absolutely nothing to do with how up-to-date you are. The proper way to use it for 99.9% of users is to set it to the version you initially install, then never touch it again, not even on a switch to a new release. In point of fact, stateVersion's entire purpose is to not change during an upgrade to a new release.

3 Likes

I wonder if stateVersion could be changed to doNotModify so we have this confusion less :wink:

2 Likes