Oooh, nice. I currently use nix-darwin, and have been wondering what home-manager brings to the table. I think I will experiment with home manager this weekend.
I understand you can use both home-manager and nix-darwin, but I don’t fully understand why you’d want to at the moment.
nix-darwin installs nix (package manager) on darwin. Home manager lets you manage the configuration of applications with nix (language). I think the sweet spot that home manager hits is managing the configuration of tools that your configuration is simple and you don’t change often. Maybe something like your prompt if you use starship or htop with some simple settings. For things I change often like neovim I find the compilation step annoying and would rather just use init.lua. Some options won’t exist in home manager which can also be annoying. There are pro’s and con’s it’s up to you to figure out the sweet spot that works for you. My dotfiles are already a solved thing so I tend to just stick with that and not complect nix/home manager.
home-manager is for managing your user environment, packages, configs. nix-darwin is for managing at the system level, more similar to what nixos provides.
Just to loop back on this, I’ve managed to create a flake.nix managing both Nix Darwin and Home Manager, without using the plugin to make Nix Darwin manage Home Manager. This loses some of the “atomicity” since I now have to run both darwin-rebuild switch --flake . and home-manager switch --flake . if I change both configs, but is IMO desirable since my Home Manager setup changes more frequently than my Nix Darwin one. Besides, running darwin-rebuilds switch --flake . requires typing in my password (presumably since it manages stuff in /etc) while running home-manager switch --flake . does not. (And the latter is much faster too.)
Hi @arkham
I was following you tutorial. After the step where you do cp -L ~/.zshrc zshrc, I had to add to git add . Otherwise it fails. Seems like an omission.
I have been wondering how to rewrite my home-manager configuration into flakes, but couldn’t make sense of it. I like how straightforward it seems to be. Thanks for the article!
It makes me want to use NixOS too, but I am not sure how to mix your examples (of using home-manager and have per-machine configurations) to make them work so that ONE one the machines is NixOS and uses your flake-enabled files, while still remaining useable by non-NixOS.
For the NixOS machine you have the flake output nixosConfigurations.<hostname>, while for the non-nixos configurations you can just use homeConfigurations.<user>@<hostname> (at least I’m pretty sure).
Oooh, nice. I currently use nix-darwin, and have been wondering what home-manager brings to the table. I think I will experiment with home manager this weekend.
I understand you can use both home-manager and nix-darwin, but I don’t fully understand why you’d want to at the moment.
nix-darwin installs nix (package manager) on darwin. Home manager lets you manage the configuration of applications with nix (language). I think the sweet spot that home manager hits is managing the configuration of tools that your configuration is simple and you don’t change often. Maybe something like your prompt if you use starship or htop with some simple settings. For things I change often like neovim I find the compilation step annoying and would rather just use init.lua. Some options won’t exist in home manager which can also be annoying. There are pro’s and con’s it’s up to you to figure out the sweet spot that works for you. My dotfiles are already a solved thing so I tend to just stick with that and not complect nix/home manager.
home-manager is for managing your user environment, packages, configs. nix-darwin is for managing at the system level, more similar to what nixos provides.
I wonder the same.
[Comment removed by author]
Just to loop back on this, I’ve managed to create a flake.nix managing both Nix Darwin and Home Manager, without using the plugin to make Nix Darwin manage Home Manager. This loses some of the “atomicity” since I now have to run both
darwin-rebuild switch --flake .
andhome-manager switch --flake .
if I change both configs, but is IMO desirable since my Home Manager setup changes more frequently than my Nix Darwin one. Besides, runningdarwin-rebuilds switch --flake .
requires typing in my password (presumably since it manages stuff in/etc
) while runninghome-manager switch --flake .
does not. (And the latter is much faster too.)Hi @arkham I was following you tutorial. After the step where you do
cp -L ~/.zshrc zshrc
, I had to add togit add .
Otherwise it fails. Seems like an omission.I found a tiny typo in the post. This cli fragment is missing an
x
:thank you, fixed! 🙏
I have been wondering how to rewrite my
home-manager configuration
into flakes, but couldn’t make sense of it. I like how straightforward it seems to be. Thanks for the article!It makes me want to use NixOS too, but I am not sure how to mix your examples (of using
home-manager
and have per-machine configurations) to make them work so that ONE one the machines is NixOS and uses your flake-enabled files, while still remaining useable by non-NixOS.For the NixOS machine you have the flake output
nixosConfigurations.<hostname>
, while for the non-nixos configurations you can just usehomeConfigurations.<user>@<hostname>
(at least I’m pretty sure).