{ pkgs, ... }@all: with all;
{
  home.packages = with pkgs; [
    delta
    (writeShellScriptBin "gst" "awk -vOFS='' 'NR==FNR {all[i++] = $0; difffiles[$1] = $0; next;} ! ($2 in difffiles) {print; next;} {gsub($2, difffiles[$2]); print;} END {if (NR != FNR) {exit;} for (i in all) {print all[i];}}' <(git diff --color --stat=$(($(tput cols) - 3)) HEAD | sed '$d; s/^ //') <(git -c color.status=always status -sb)")
  ];

  programs.git = {
    enable = true;
    package = pkgs.gitFull;
    userName = ''Lennart J. Kurzweg (Nx2)'';
    userEmail = "git@${hyper.domain}";
    delta = {
      enable = true;
      options = {
        line-numbers = true;
        side-by-side = false;
        features = "unobtrusive-line-numbers decorations";
        whitespace-error-style = "22 reverse";
      };
    };
    extraConfig = {
      credential = {
        "https://git.da.dicos.de".username = lib.mkIf (hyper.host =="NxWSL") "lkurzweg";
        "https://git.da.dicos.de".password = lib.mkIf (hyper.host =="NxWSL") "Test";
      };
      url."ssh://git@git.da.dicos.de/".insteadOf = lib.mkIf (hyper.host =="NxWSL") "https://git.da.dicos.de/";
      url."ssh://git@github.com/".insteadOf = "https://github.com/";
      pull.rebase = false; # true
    };
  };
  programs.lazygit = {
    enable = true;
    settings = {
      windowSize = "normal";
      gui.theme = with rice.color; {
        lightTheme = false;
        activeBorderColor = [ foreground "bold" ];
        inactiveBorderColor = [ border ];
        optionsTextColor = [ tertiary.base ];
        selectedLineBgColor = [ secondary.base ];
        selectedRangeByColor = [ weird.bright ];
        showRandomTip = true;
        animateExplosion = true;
        cherryPickedCommitFgColor = [ accent.base ]; # Foreground color of copied commit
        cherryPickedCommitBgColor = [ secondary.dark ]; # Background color of copied commit
        markedBaseCommitFgColor = [ accent.base ]; # Foreground color of marked base commit (for rebase)
        markedBaseCommitBgColor = [ secondary.dark ]; # Background color of marked base commit (for rebase)
        unstagedChangesColor = [ negative.base ]; # Color for file with unstaged changes
        defaultFgColor = [ "default" ]; # Default text color
      };
    };
  };
}
