3 ms·
Nothing beats nix + home manager. But it is fun to see how many different ways people go about solving this particular problem. All of them have their tradeoffs
by dinkleberg 1y ago
Nothing beats nix + home manager. But it is fun to see how many different ways people go about solving this particular problem. All of them have their tradeoffs and annoyances.
- whacked_new 1y agoI advocate (and use) nix + home manager too but when you need a one-off change or test and realize you need to do the whole commit and switch thing, or when you are debugging and spelunk through the read only nix store, or when you set up a new (non-nix) computer and do the nix install, home-manager install, run the switch and get a deluge of errors... it's simultaneously awesome but "can I really recommend this to <colleague>?"
- AgentElement 1y agoWith nix + home manager, you can use `mkOutOfStoreSymlink` to make symlinks between the dotfile repo and the target destination in `.config`. I've found this to be the most ergonomic way to have nix-managed dotfiles. Because the out-of-store dotfile repo is symlinked, you can make little changes to your system without doing the whole commit and switch dance. For example, here's a snippet pulled from my dotfiles that does this for multiple dotfiles at once: home.file = builtins.mapAttrs (key: value: { # symlink ~/dotfiles/configs/{value} to ~/{key} source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/dotfiles/configs/${value}"; }) { ".zshrc" = "zsh/zshrc"; ".p10k.zsh" = "zsh/p10k.zsh"; ".config/sway/config" = "sway/config"; ".config/nvim/init.lua" = "nvim/init.lua"; };
- nothrabannosir 1y agoCaveat: This works for literal dotfiles in your repo but it doesn’t help you if you use nix declared config, e.g. programs.git
- whacked_new 1y agoOh right, I do this too! At the same time it often feels like a veneer of control, like you can control exactly where to place the door, but what's in the messy room (like emacs profiles if you do that) might be hidden behind the very nice and solid door. It's like in python projects I lock python3 and uv, and beyond that it's wild west. Still beats everything else, still feels a bit incomplete, and still feels somewhat unresolvable.
- nothrabannosir 1y agoThe configs I tweak are git, bash and emacs, and each has their own way to load extra config from a local file. You can use this for stateful config local to a machine and out of the nix store. It depends on buy-in from the tool so it’s not a panacea but it works for my use cases at least. I also don’t like to switch config for every change and it turns out I rarely have to.
- kesor 1y agoAdvantages of using nix are so numerous, it would be a sin to even try to list all of them. Suffice it to say that using HM and Nix to manage dotfiles is the ultimate peak of what one can do. I just wanted to write +1 but thought that would be too short.
- nothrabannosir 1y agoThis whole thread is a case study in “nix is worse ROI for every of the individual things it can do, but it’s the same I for all of them”. Nix is definitely The Way to solve this problem, but I wouldn’t recommend it if the only thing you’ll ever use it for is home-manager. Once you’ve paid the investment, though… I never want to rsync a dotfile ever again in my life.
- lloeki 1y agoUntil and unless you're on a system which doesn't or can't have nix (RAM size preventing evaluation, $job policy, ...) I really appreciate and use nixpkgs+nix-darwin as well as NixOS and flakes and per-project nix-shell/nix develop through and through; even then, Home Manager is a bridge too far for me. One of the features of my dotfiles setup is that it has zero dependencies (beyond a POSIX shell).