`...homeDirectory' is note of type `path'. darwin

I am really struggling to figure out what’s going on here. I’d be super grateful for any direction!

It’s a very very basic setup in this github repository

same error if I remove the quotes and the trailing slash

Please share the full error and the exact command you ran.

1 Like

but of course thank you

 $ nix run nix-darwin -- switch --flake .
building the system configuration...
warning: Git tree '/Users/dot/.config/nix-darwin' is dirty
error:
       … while evaluating the attribute 'value'
         at /nix/store/djws0nzaa2g7xz9iv90ja8yxqddm37yy-source/lib/modules.nix:846:9:
          845|     in warnDeprecation opt //
          846|       { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          847|         inherit (res.defsFinal') highestPrio;

       … while evaluating the option `system.build':

       … while evaluating the attribute 'mergedValue'
         at /nix/store/djws0nzaa2g7xz9iv90ja8yxqddm37yy-source/lib/modules.nix:881:5:
          880|     # Type-check the remaining definitions, and merge them. Or throw if no definitions.
          881|     mergedValue =
             |     ^
          882|       if isDefined then

       … while evaluating definitions from `/nix/store/9w5mmnkypiqczdlvmc4l2hd4xc3m44bq-source/modules/system':

       … while evaluating the option `home-manager.users.dot.home.homeDirectory':

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

       error: A definition for option `home-manager.users.dot.home.homeDirectory' is not of type `path'. Definition values:
       - In `/nix/store/j7wvymrh5cyc6m4gqac441cv4xgf27w3-source/nixos/common.nix': null

Not sure what’s going on here but the last line of your error message says it’s coming from common.nix, which I imagine is home-manager/nixos/common.nix at 66c5d8b62818ec4c1edb3e941f55ef78df8141a8 · nix-community/home-manager · GitHub . That looks to me like home-manager is expecting users to be defined in Nix config, which I’d have thought doesn’t work as an assumption even on Linux :thinking:

FWIW my own Darwin config with home-manager simply doesn’t set homeDirectory; only home.username.

It works on NixOS. If you don’t have a user, it doesn’t make sense to make an HM config. I would imagine it’s the same issue on darwin; you probably have to define the user first in the nix-darwin config.

P.S. extremely odd design that nixos/common.nix is getting imported in nix-darwin :grin:

okay this is wild. if I comment out the line entirely I still get the same error, and the path isn’t declared anywhere else :joy:

This is how you fix the error.

1 Like

The error text tells you that that line of config which you’re commenting out is not actually taking effect:

error: A definition for option `home-manager.users.dot.home.homeDirectory' is not of type `path'. Definition values:
       - In `/nix/store/j7wvymrh5cyc6m4gqac441cv4xgf27w3-source/nixos/common.nix': null

(note that it is not telling you that the definition comes from your config!)

I presume that is why commenting it out is changing nothing.

1 Like

That did it, thank you so much!

I am so grateful for you for making this clearer!! that tidbit is really going to help me on my nix journey!