by guthriej · 2y ago · 0 comments
Aside: I use NixOS with home-manager (on linux and mac), which makes this trivial [1]. Added the following lines to my home-manager config:
programs.git = {
enable = true;
...
includes = [
{
condition = "hasconfig:remote.*.url:git@github.com:<work>/**";
contents = {
user.email = "<work email>";
};
}
];
}
[1]: https://nix-community.github.io/home-manager/options.xhtml#o...Curiosity got the better of me so I looked it up at https://nix-community.github.io/home-manager/ and it indeed does purport to provide benefits I guessed at and then some.
Whether that's better than just manually managing things yourself is altogether a different matter.
In TFA the author must set up two configurations: the .gitconfig, and the file which is included in the .gitconfig. Home-manager does this automatically through one config parameter. That is what I was pleased with and wanted to share.