srid / nixos-config

KISS NixOS configuration based on Flakes & flake-parts (supports macOS too)
433 stars 17 forks source link

Multiple users for home-manager configs #66

Open robled opened 2 weeks ago

robled commented 2 weeks ago

I've been looking through the code and I'm trying to determine if it's possible to apply the same home-manager config to multiple users. I see the primary user defined in config.nix, but I'm not seeing a place to define a second user.

srid commented 2 weeks ago

Yea, this is something I want to do more cleanly as part of https://github.com/juspay/nixos-unified-template/issues/93

Take a look at the linked (in the comment) juspay/remote-development repo for one approach, and let me know what you think in that issue.

srid commented 2 weeks ago

But assuming this is all you want:

the same home-manager config to multiple users.

You can achieve this using home-manager.sharedModules.

https://github.com/srid/nixos-config/blob/5b8f1dfa7e9a4def553a321b8fb4e1224b06138f/modules/nixos/default.nix#L13-L16

My above comment was about having separate home-manager config for each user, though it also addresses having a second user and so on in your original question.