{ pkgs, packagesPath, ... }:

{
  home.packages = [
    pkgs.git-crypt
    (pkgs.callPackage (packagesPath + /git-crypt-rm-gpg-user) { })
  ];

  programs.git = {
    enable = true;
    lfs.enable = true;
    userEmail = "dmitriy@pleshevski.ru";
    userName = "Dmitriy Pleshevskiy";
    signing = {
      key = "17041163DA10A9A2";
      signByDefault = true;
    };
    includes =
      import ./myrepo.secret.nix
      # My main account was suspended due to sanctions
      ++ import ./github.secret.nix
      # Work account
      ++ import ./gitlab.secret.nix;
    ignores = [ ".nlsp-settings" ];
    extraConfig = {
      init.defaultBranch = "main";
      pull.rebase = true;
      advice.skippedCherryPicks = false;
    };
    aliases = {
      co = "switch";
      cob = "switch -c";
      cobf = "switch -C";

      st = "status -sb";

      d = "diff";
      dc = "diff --cached";

      aa = "add .";
      ai = "add -i";

      c = "commit";
      cm = "commit -m";
      ca = "commit --amend";
      cam = "commit --amend -m";
      can = "commit --amend --no-edit";

      p = "push";
      pt = "push --tags";
      po = "push origin";
      pot = "push origin --tags";
      pf = "push --force-with-lease";
      pfo = "push --force-with-lease origin";
      pl = "pull";
      plo = "pull origin";
      plup = "pull upstream";

      f = "fetch";
      fo = "fetch origin";
      foa = "fetch --all";
      foap = "fetch --all --prune";

      rb = "rebase";
      rbi = "rebase -i";
      rbc = "rebase --continue";
      rba = "rebase --abort";

      ch = "cherry-pick";
      chi = "cherry-pick -i";
      chc = "cherry-pick --continue";
      cha = "cherry-pick --abort";

      re = "restore";
      res = "restore --staged";
      resw = "restore --staged --worktree";

      rls = "ls-remote --heads";
      rlso = "ls-remote --heads origin";
      rlsu = "ls-remote --heads upstream";

      lo = "log --pretty=oneline";
      los = "log --pretty='format:%s'";
      loH = "log --pretty='format:%H'";

      sma = "submodule add";
      smui = "submodule update --init";

      s = "stash";
      sm = "stash push -m";
      sl = "stash list";
      sa = "stash apply";
      sai = "stash apply --index";
      sp = "stash pop";
      spi = "stash pop --index";

      t = "tag";
      tf = "tag --force";
    };
  };
}