I want to use Home Manager for my git config.
According to the Home Manager Appendix A,
the option the way to do it is with programs.git.settings,
which writes the contents to the ~/.config/git/config file.
But when I run sudo nixos-rebuild switch i get this error:
error: The option 'home-manager.users.my-user.programs.git.settings' does not exist. Definition values:
- In '/etc/nixos/dev/default.nix':
I thought this was weird and I must be doing something wrong.
I found that nixpkgs uses the option programs.git.config instead.
So I tried it and got the same error.
I kept searching but no one else seemed to even use this option, they would just put their config in the git attribute set like this:
git = {
enable = true;
userEmail = ...;
...
};
Then I stumbled upon this blog post, where they use git.extraConfig, and that was it, i could build my system now.
What I don’t understand is why does the documentation has programs.git.settings if that doesn’t actually exist, and git.extraConfig is not present anywhere in the documentation. Was it the option before but it was changed and they didn’t update the documentation?
Btw I’m using nix 25.05 stable, same for home manager. Also the file with git config is not in home.nix, it is imported from /etc/nixos/dev/default.nix. I’m not sure if that affects the problem.
Looks like the option was changed last month. If you’re using stable, you’d still have the other version of home-manager. (But the online documentation is built from the unstable version of home-manager)
I use man home-configuration.nix rather than the online documentation, in part because of this. It’s generated from the same commit of home-manager that I’m actually using.
Probably best not to think of it as canonical at the moment. Mainly because the manual is not automatically built on all pushes, it requires me to manually push to the sourcehut Home Manager repository where the CI build happens. It would be nice to set up automatic mirroring at some point.
That said, may still be worth having a link somewhere to the release versions since they are not available on the nix-community pages.
You see, I wasn’t aware of that URL. And in Home Manager Manual it only has the latest unstable version. Not sure why there are 2 websites for the same documentation .
I agree with what @NobbZ said, it would be clearer to have an official site linked from other docs with a clear version of the page you’re looking at. Nix documentation feels very fragmented
Don’t believe it to be officially part of Home Manager, and it says it’s “not affiliated with the NixOS Foundation”, but there’s home-manager-options.extranix.com
I know, what I mean is the nix ecosystem in general. It’s just that it feels very disorganized with everything all over the place (referring to documentation). I’m not sure about this, but home manager feels like a major part of nix systems for most users. If that’s the case, I believe the home manager project should aim to have sort of similar documentation to the nixos project.
While the NixOS foundation absolutely shouldn’t be blamed for the home-manager docs (that’s kinda like blaming Linus Torvalds for a typo in the systemd docs), this isn’t wrong.
Even if you stick to NixOS foundation it’s split between the nixpkgs, nix and NixOS manuals, as well as nix.dev, all of which hosted conveniently under two different TLDs with no clear distinction between them or clear explanation about the exact purpose of each
At least the NixOS/nixpkgs reference manuals are also really poorly formatted, and can’t seem to decide whether they’re reference docs, deployment docs, user guides, tutorials, …
And all this is before we get into the issues caused by the flakes vs non-flakes schism, with all the various implications that has on what docs apply to any given situation (this is especially bad with home-manager, but admittedly at least the NixOS foundation is pretty good at just never mentioning flakes, thereby sidestepping the issue).
But yeah, the nix ecosystem docs story is a known problem. It’s clearly a grown-organically mess, rather than a set of documents designed to lead people to a specific outcome. Things have improved over the years, http://nix.dev is at least a good attempt (even if it recommends a horrible footgun), but without major funding in that direction it won’t be solved.
There’s only so much purely volunteer work will get you, and I’m sure @rycee also wishes the home-manager docs were better. You learn to live with it.