home/base: enable Git maintenance

This is enabled in home-manager becuase Git attempts to hardcode the
path when it is done through Git. Enabling Git in home-manager creates a
managed config at $XDG_CONFIG_HOME/git/config, but if ~/.gitconfig
exists, git will use that instead which still allows for mutable config.
The activation script is configured to automatically create ~/.gitconfig
if it doesn't exist, so everything should still work exactly as before.
This commit is contained in:
NullBite 2025-02-15 20:45:41 +00:00
parent 8d011735f4
commit acb902b1ad
Signed by: nullbite
GPG Key ID: 6C4D545385D4925A

View File

@ -35,6 +35,25 @@ in
})
];
programs.git = {
enable = lib.mkDefault true;
maintenance.enable = lib.mkDefault true;
};
# this allows `git config --global` commands to work by ensuring the
# presense of ~/.gitconfig. git will read from both files, and `git config`
# will not write to ~/.gitconfig when the managed config exists unless
# ~/.gitconfig also exists
home.activation.git-create-gitconfig = lib.mkIf config.programs.git.enable
(lib.hm.dag.entryAfter [ "writeBoundary" ] ''
_nixfiles_git_create_gitconfig () {
if ! [[ -a "$HOME/.gitconfig" ]] ; then
touch "$HOME/.gitconfig"
fi
}
run _nixfiles_git_create_gitconfig
'');
programs.btop.enable = lib.mkDefault true;
programs.ranger = let