Set up nixos + home manager via flake

Just had my first successful nixos-rebuild thanks to your input!

Thanks so much for your explanations, they’ve helped a lot. Regarding the options, this is still a bit blurry to me. I understand that mkOption exposes a variable to the config. So user = mkOption {...} allows me to use config.user. However I’m still not quite certain how that option gets its initial value from globals.user, but I’m fine with not understanding it at the moment, I’m sure it’ll come in time.

I’m excited to build up my config now. Thanks again!

EDIT: Unfortunately, I was quick to run into a problem I can’t seem to fix. I cannot seem to access config properly inside home-manager.users.${config.user}.

If you take a look at my common module (line 67-68), if I uncomment either of those lines, I get the error:

error: attribute 'homePath' missing

In case of uncommenting the first line, and

error: attribute 'dataHome' missing

in case of the second line. So something about how I access properties inside config is wrong. I’ve looked through your config and noticed that you do the same thing. Not quite sure what I’m doing wrong here. Also, after looking at the source code of the xdg module, my understanding is that config.xdg.dataHome should be set after doing xdg.enable = true because of this:

## ...
 in mkIf cfg.enable {
      xdg.cacheHome = mkDefault defaultCacheHome;
      xdg.configHome = mkDefault defaultConfigHome;
      xdg.dataHome = mkDefault defaultDataHome;
      xdg.stateHome = mkDefault defaultStateHome;
## ...

But apparently it’s not.

EDIT: Actually line 68 of my common module, e.g. #xdg.dataHome = "${config.xdg.dataHome}/.local/share"; doesn’t make sense anyway, but you can look here to see where I tried to access config.xdg.dataHome. It’ll also fail with

error: attribute 'dataHome' missing