Usually, I’d like to install program per user, hence I use home-manager. But for some programs like alacritty, I want to install it in system level. I could just install it without home-manager but I don’t know how to configure it. I like the way home-manager configure the programs, e.g. alacritty configuration.
The usecase is I have multiple users in one machine, all of them will have the same program like alacritty, polybar, rofi and the same configuration. Currently I copied all of the configuration for each users using home-manager, and I have no idea how to configure it without home-manager.
How to install home-manager packages in system level? If its impossible how to configure the programs without home-manager?
I’m not a nix pro but AFAIK there isn’t really much difference between user-level and system-level installs. In both cases the program is located in the nix store and if two (or more users) have it installed via home manager, they point to the same files in the store so you’re not “saving” or “losing” storage space either way.
Whether a program is “installed” for a user just depends on a few symlinks and environment variables.
You could use home-manager.sharedModules
(Appendix B. NixOS Module Options).
3 Likes
I don’t mind about the storage, but I do mind about doing the copying all configuration for each users.
Gotcha. Maybe you could put the shared config in a shared file that gets imported by each users config?
Thanks, this works. A little caveat tho, the users also must managed by home-manager, at the very least declare this, otherwise the users didn’t get the shared modules.
home-manager.users.<users> = {}