Newbie home-manager confusions

From what I’ve gathered, rycee/home-manager appears to be the best idea for manager user packages and configurations. I start to get confused around two things:

  1. Does home-manager “replace” users.users.<name>.packages in the system config? Should home-manager be used instead of this option? Should home-manager be placed in this option?
  2. Can home-manager be used to manage xsessions for some users but the system config’s options otherwise (e.g. use home-manager for my user account but stick with a system default, e.g. KDE, for root and other users)?
  3. In a Reddit “post your config” thread, I noticed this config has explicitly stated persistence. Is this a more advanced setup or something a beginner (e.g. me) should worry about?

And most importantly

  1. Is there some kind of manual or piece of documentation I am missing? It feels like I am not RTFM but I can’t exactly find TFM.

Does home-manager “replace” users.users.<name>.packages in the system config? Should home-manager be used instead of this option? Should home-manager be placed in this option?

No, you would need sudo permissions to edit users on a machine, that’s what nixos-rebuild is for.

Can home-manager be used to manage xsessions for some users but the system config’s options otherwise (e.g. use home-manager for my user account but stick with a system default, e.g. KDE, for root and other users)?

No, window managers and desktop environments need to be instantiated without user input. This is the responsibility of /etc/nixos/configuration.nix to determine what the computer initializes for WM and DE. You can think of the division as: /etc/nixos/configuration.nix for your system, and is concerned about configuration until the login screen. And home-manager is concerned about everything after you login ( dot-files, settings, shell, etc)

In a Reddit “post your config” thread, I noticed this config has explicitly stated persistence. Is this a more advanced setup or something a beginner (e.g. me) should worry about?

This is more advanced, you can see that one of the files is for passwords that probably exists locally, but isn’t version controlled. His /nix/persistent/adisbladis/ is probably mounted in a special way to give a consistent environment across his machines.

Is there some kind of manual or piece of documentation I am missing? It feels like I am not RTFM but I can’t exactly find TFM.

man home-manager for running the tool and updating your user environment.
man home-configuration.nix for viewing what options are available for you to configure.

3 Likes

What’s the purpose of the double-symlink with mkPersistentLink though? Why not just point the file source directly at /nix/persistent/adisbladis/filename?

I’m not entirely sure, we can ask him @adisbladis

Thank you for the clarifications, they are helpful for me.