after using Debian for many years I am trying out Nixos and almost everything works as expected.
Now I’d like to set the language for a (specific) user, but want to keep C or en_US.UTF-8/UTF-8 as the default locale for other users, especially root. So I have
Do I, i am not too sure about that? Since gnome settings/systemd-localed doesn’t work, it is just the only other possibility to set the locales I know about.
But let’s say I want to set a var for a specific user and do not yet want to use home-manager. There are so many place where I could set a var, that I am still lost
I could put it in ~/.zprofile (the user’s default shell is zsh), but without having tested it I suspect that this won’t set the var for the whole gnome session?
On the other hand if I put it in ~/.profile and log in on a virtual console in text mode it will not be set either, because zsh ignores it.
Obviously I am not too familiar with NixOS yet, but as far as I understand, gnome uses systemd-localed to set up locales, but since this would or at least could change the system configuration it is disabled in Nixos [1].
I haven’t tested it, but it seems that home-manager would create a shell script ~/.nix-profile/etc/profile.d/hm-session-vars.sh, which then would be sourced by all shells.
Have you tried changing the language? I’m quite sure it should work. I manually changed gnome settings many times without issue.
NixOS manages system level configuration. User level settings like your gnome user’s language should be unchanged, unless you are using Home Manager to overwrite them.
I don’t know, it’s probably possible (since basically everything is when using Nix ), but I’m quite sure it would be easier with Home Manager.
To be honest, for some reason I was also reluctant to start using Home Manager until month or two ago. I don’t know why I was reluctant, but I’m very glad that I started using it. Configuring Gnome with Home Manager is really easy, change whatever you want in Gnome setting and just use dconf dump /org/gnome and add those dconf setting to you Home Manager module. You can see how I did it here: nix-setup/modules/home-manager/default.nix at a41e35034f500e23359045e94be643d4bff60ad5 · MatejaMaric/nix-setup · GitHub
I did too, but I guess you never tried to change the language?
I searched for an explanation and found the one on github I posted earlier. gnome-settings not only allows to set the language of the logged in user, but also for the login screen. It relies on systemd-localed, which is disabled in nixos, probably exactly for this reason.
I already did the same thing to change the systemwide dconf-defaults (without home-manager), so I can see how convenient home-manager would be.
There a few reasons for me not using it, at least not yet for my private computer:
I don’t understand what it would do in certain situations: For example if I already had written my own .zshrc and used home-manager to configure zsh, what would happen to my existing .zshrc?
I have a lot configuration files and shell scripts in my home directory. It would take me ages to move the configuration into home-manager (if it is even possible for all programs) and I haven’t found out yet if or how I could put my shell scripts into the nixos configuration.
In the future I do want to keep my files (documents, photos, music,…) somewhere else, but right now most of them are still in my home directory and as long as they are there, I’ll have to take my home-directory with me anyway, so I don’t think I would benefit greatly from home-manager.
Home Manager will error out before overwriting any existing files. (And in case there’s a bug… you back up your home directory, right?)
Home Manager isn’t an all-or-nothing thing. Keep as much config out of it as you want. I started with just a list of home.packages because I thought using sudo to edit a system-wide config file just to add a program for myself was silly, and only gradually started adding config stuff to it. I’m still only around 60% migrated. It’s totally fine.