diff --git a/modules/packages/git.nix b/modules/packages/git.nix index 437fa37..22e99a7 100644 --- a/modules/packages/git.nix +++ b/modules/packages/git.nix @@ -1,21 +1,49 @@ -{ ... }: +{ pkgs, lib, ... }: -{ +let + ugp = "/nix/config/secrets/git_uni"; +in { home-manager.users.hu = { - programs.git = { - enable = true; + home.file."/home/hu/.config/git/personal" = { + text = '' + [user] + email = "me@caem.dev" + name = "caem" + signingKey = "E50FC66B5062070DC462661C69A830D03203405F" - userName = "caem"; - userEmail = "me@caem.dev"; - signing = { - key = "E50FC66B5062070DC462661C69A830D03203405F"; - signByDefault = true; - }; + [tag] + gpgSign = true - extraConfig = { - init.defaultBranch = "master"; - pull.rebase = true; - }; + [init] + defaultBranch = "master" + + [pull] + rebase = true + ''; + }; + + home.file."/home/hu/.config/git/uni" = (lib.mkIf (builtins.pathExists ugp) { + source = "/nix/config/secrets/git_uni"; + }); + + home.file."/home/hu/.config/git/config" = { + text = '' + [gpg] + program = "${pkgs.gnupg}/bin/gpg2" + + [includeIf "gitdir:~/programming/personal/**"] + path = ~/.config/git/personal + + [includeIf "gitdir:~/programming/forks/**"] + path = ~/.config/git/personal + + '' + (if builtins.pathExists ugp then '' + [includeIf "gitdir:~/programming/uni/**"] + path = ~/.config/git/uni + + '' else '' + # Uni config omitted + ''); }; }; }