{ lib
, config
, pkgs
, ...
}:
with lib;
with lib.plusultra; let
  cfg = config.plusultra.cli-apps.git;
in
{
  options.plusultra.cli-apps.git = {
    enable = mkEnableOption "git";
  };

  config = mkIf cfg.enable {
    home.packages = with pkgs; [
      delta
      gh
    ];
    programs.git = {
      enable = true;
      userName = "Harald Hoyer";
      userEmail = "harald@hoyer.xyz";
      extraConfig = {
        init.defaultBranch = "main";
        "credential \"https://github.com\"" = {
          helper = "!gh auth git-credential";
        };
        alias = {
          co = "checkout";
          ci = "commit";
        };
        pull.ff = "only";
        core.pager = "delta";
        delta = {
          features = "side-by-side line-numbers decorations";
          syntax-theme = "DarkNeon";
          light = "false";
          line-numbers = "true";
          navigate = "true";
        };
        interactive.diffFilter = "${pkgs.delta}/bin/delta --color-only";
        merge.conflictStyle = "diff3";
        diff.colorMoved = "default";
      };
    };

  };
}
