What's the simplest path to transition to NIX

Hi everyone, I’m in the process of transitioning to NixOS because I’m tired of having to reconfigure everything manually every time, my goals are to have my nix config setup in a way that I don’t have to touch it forever. On every linux instances I just want my editor (the unstable variant) Helix, Atuin, Yazi, zoxide, zsh, zig and zls (unstable) clang, and a few more things like btop/bat/eza/tre/lazygit.

Right now, I have a .dotfiles repo that I manage with stow. I’ve installed NixOS, but now I want to know how I can I transition from stow to home manager ? I would also appreciate if you could suggest a tutorial where someone goes through the whole process, of setting up Nix, than home manager, etc. Also how do I handle version control of my config ? Thanks in advance.

1 Like

Consider not doing that, at least initially. Let stock NixOS manage the set of packages you have, and stow for managing dotfiles. As long as you store the dotfile and NixOS config in the same git repository, you’d still have reproducible setup.

After that works for you for some time, consider if you need to migrate to home manager.

I personally don’t use home manager, and just have a short script to link my dotfiles appropriately:

  • home manager installs packages for the single user, and I prefer using only global packages.
  • with symlinks, it’s easier to test out ad-hoc edits to config files, as you don’t need to rebuild the entire system config for that.

To clarify, what I am saying here is not “don’t use HM” — HM is great and has tone of features! What I am rather saying is that there’s an option to not use HM for dotfiles.

For the reference, my dotfile+nix setup is here, but it’s a pile of bespoke scripts without docs, so it’s a poor example for learning :slight_smile:

2 Likes

Ok seems reasonable, then, how can I integrate nix into stow ? do you have any suggestions for that ? because idk if I can use stow to symlink into /etc/nixos/ ?

Do you use flakes? If you do, then you don’t need to symlink anything on NixOS side.

If you don’t use flakes, then I’d suggest just manually symlinking /etc/nixos/configuration.nix once — I think you need to be root to do that, so coaxing stow to do that for you might be hard. And you probably want to link you configuration first and install stow through that.

1 Like

I don’t use flakes, I’m still learning about it, but from my limited understanding you specify an environment through the input/output of the flake ? I think for now I’m going to take your suggestions, and as I get more comfortable with Nix I’ll probably ask around if I need more specific help, thanks for your answers :slight_smile:

1 Like

Flakes are a complicated and somewhat divisive topic!

I’d maybe suggest starting without them. Once you are comfortable with NixOS, one thing I’d recommend doing is to stop using channels and switch to one of:

  • flakes
  • npins
  • manual pinning of nixpkgs through specific URL

But this is an advance topic, not because it is inherently hard (it’s actually conceptually simpler than channels stuff), but because at the moment community is divided on what’s the best replacement for channels among the options.