Where does personal configuration go?


I’m very new to NixOS, and I’m sure there are many basic things I’m missing. Here’s one of them: using configuration.nix I was able to install zsh and set it as my user’s login shell. However, it’s not clear to me how I’m expected to configure zsh for myself. What I’ve done for now is copy over .zshrc from another system and put it in $HOME, but that seems very much counter Nix philosophy. How do I set things up so that zsh configuration is part of the data that Nix keeps track of?

I’m honestly new as well so others please do chime in with better or more in-depth suggestions. While I’m not sure where we would declaratively place the important bits of a .zshrc-style file or if those can somehow be added manually, there are a few options in the manual in this case.

For customizing zsh specifically, the options start here.
There are also some configuration options for all shells here and here.
You can also use this to force nix to keep track of files that would typically go in /etc/, I think.

If you want to configure system-wide zsh settings, you can use the options that @vulcao mentioned. If you want to configure dotfiles (including zsh) declaratively per-user, then home-manager is a great too to do so:


I would say that today Nix doesn’t provide a definitive answer to the problem of managing dotfiles, so there isn’t a single recommended approach.

Some people use home-manager, some just configure stuff in ad hoc way, some (like me) use bespoke scripts for syncing dotfiles.

See also this thread: How do you organize your configuration?

1 Like