{ pkgs, lib, config, ... }: let enabled = config.mod.git.enable; in { options = { mod.git = { enable = lib.mkEnableOption "enable git module"; }; }; config = lib.mkIf enabled { home-manager.users.alex = { lib, ... }: { programs.git = { enable = true; includes = [ { path = ./gitconfig; } ]; signing = { key = config.age.secrets."alex.pinwheel-github.com-signing.pub".path; signByDefault = true; }; settings = { rerere.enable = true; # Tells Git to use SSH instead of the default GPG gpg.format = "ssh"; }; }; home.file.".ssh/config".target = ".ssh/config_source"; home.activation.sshConfig = lib.hm.dag.entryAfter [ "writeBoundary" ] '' run cat ~/.ssh/config_source > ~/.ssh/config run chmod 600 ~/.ssh/config ''; home.packages = [ pkgs.tig ]; home.file.".tigrc".text = '' set main-view-line-number = yes set main-view-line-number-interval = 1 ''; }; age.secrets = { "alex.pinwheel-github.com-signing" = { file = ../../../../secrets/pinwheel/alex.pinwheel-github.com-signing.age; path = "/home/alex/.ssh/alex.pinwheel-github.com-signing"; owner = "alex"; group = "users"; }; "alex.pinwheel-github.com-signing.pub" = { file = ../../../../secrets/pinwheel/alex.pinwheel-github.com-signing.pub.age; path = "/home/alex/.ssh/alex.pinwheel-github.com-signing.pub"; owner = "alex"; group = "users"; }; }; }; }