Home manager option `programs.git.settings` does not exist, use `programs.git.extraConfig` instead

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':

Here is an example of my file:

{ pkgs, ... }:
{
  programs = {
    git = {
      enable = true;
      settings = {
        init.defaultBranch = "main";
        ...
      };
    };
  };
}

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)

Well damn… this makes me think that they should have version options in the doc pages like they do in the nixpkgs page.

anyways thanks for your help :slight_smile:

1 Like

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.

1 Like

Since 25.05 will be deprecated in 3 days, you might as well switch to 25.11 now and use .settings.

Oh that’s cool, didn’t know they had pages for options. Definitely gonna save me some bandwidth. Thank you :smiley:

I will, but not now because I’m just trying to get my system up and running with the same settings as i had before.

For what it’s worth, the documentation for Home Manager 25.05 is available at https://home-manager.dev/manual/25.05/.

1 Like

Is this canonical?

If yes, why isn’t it linked from the repository?

Only link I’ve seen from the repo is pointing at the nix-community GH pages.

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.

To be honest, I would appreciate an official searchable index like the NixOS search, with tabs for stable and unstable versions of HM.

Though a switchable manual for both branches (similar to NixOS and nixpkgs manuals) would be a good first start.

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 :thinking:.

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

It’s not related to nix at all, this is a 3rd-party project.
Ultimately nix and nixpkgs can’t be on the hook for that.

2 Likes

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.

I disagree that most nix users use it, and I don’t use home-manager to manage my user configs.

I am aware of extranix and mynixos.

But I consider it quite bad, that one has to use a 4th party website for this. Also with all those sites I am never sure how up to date they are.

4 Likes

And that’s exactly my point, it’s not about whether it exists, but whether it can be easily found by inexperienced users.

1 Like

Sorry, I thought it was

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 :slight_smile:

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.

1 Like