From acb902b1ad8cf3281cde3de8bfa5571a304824ea Mon Sep 17 00:00:00 2001 From: NullBite Date: Sat, 15 Feb 2025 20:45:41 +0000 Subject: [PATCH] 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. --- home/profile/base.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/home/profile/base.nix b/home/profile/base.nix index 148a127..334c65c 100644 --- a/home/profile/base.nix +++ b/home/profile/base.nix @@ -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