{ pkgs, ... }:

{
  home.packages = with pkgs; [ git-crypt ];

  programs.git =
    let
      package = pkgs.git.override { withLibsecret = true; };
    in
    {
      enable = true;
      package = package;
      userName = "Martin Berg Alstad";
      userEmail = "git@martials.no";

      aliases = {
        amend = "commit --amend";
        cm = "commit";
        s = "status";
        p = "push";
      };

      signing = {
        signByDefault = true;
        key = "706F53DD087A91DE";
      };

      extraConfig = {
        push.autoSetupRemote = true;
        safe.directory = "/etc/nixos";
        credential.helper = "${package}/bin/git-credential-libsecret";
      };
    };
}
