Installing Home-Manager

I’ve been using NixOS for about two years but never tried home-manager!

Today I thought I would give it a go and I was immediately struck by one question.

One of the central ideas around NixOS is being ‘declarative’. So when I went to the Home Manager Manual (link to manual) I was surprised that it first starts with telling a NixOS (option 2) user to;

sudo nix-channel --add home-manager
sudo nix-channel --update

If I ‘search’ in ‘packages’, I can see there is a ‘home-manager’ package. (link to package)

Wondering why the guide for first-time users doesn’t say -‘add this to your configuration.nix’ as running any kind of command seems to be imperative? Thoughts and perhaps has anyone seen a first-time user guide that is declarative?

1 Like

Yes, that’s really not great. I’m not aware of any good guide to do it properly, but I’ll sure write one for once I figure out how to do it smoothly. My preliminary way of doing it is encoded here: home-damager/lib.nix at a4b9686f43c32dfa7d3e5ea6cf8aeb76017f82e3 · fricklerhandwerk/home-damager · GitHub

But it’s obviously flawed, because you actually want your Home Manager release to determine your Nixpkgs version rather than passing it in. Unfortunately Home Manager’s interfaces are weird in many regards, and the technically correct solution would be fix those first – then there won’t be much left to explain. But that’s a lot more effort which I won’t invest before I have a very clear idea for what the final result should be like.

1 Like

Yes, it was a surprise when the version didn’t match. Also playing around and learning trying to find a repeatable, consistent method, :+1: (home-damager :rofl:)

1 Like

I did not win! I struck multiple issues trying to ‘pin’ home-manager to a previous version of NixOS (23.11) which is currently less than 2 weeks out of date! :frowning:

As an aside - For me personally, one of the key things I want in an OS is the ability to decide how and when I do updates.