about summary refs log tree commit diff stats
path: root/modules/home.legacy/conf/git/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/home.legacy/conf/git/default.nix')
-rw-r--r--modules/home.legacy/conf/git/default.nix96
1 files changed, 96 insertions, 0 deletions
diff --git a/modules/home.legacy/conf/git/default.nix b/modules/home.legacy/conf/git/default.nix
new file mode 100644
index 00000000..6680c598
--- /dev/null
+++ b/modules/home.legacy/conf/git/default.nix
@@ -0,0 +1,96 @@
+{
+  lib,
+  config,
+  ...
+}: let
+  gitIgnoreFile = ./git_ignore.git;
+  gitTemplateFile = ./git_template.git;
+in {
+  programs.git = {
+    enable = true;
+    #package = pkgs.gitAndTools.gitFull; # TODO: for git send-email support
+    aliases = import ./aliases.nix {inherit lib config;};
+    extraConfig = {
+      core = {
+        excludesFile = "${gitIgnoreFile}";
+      };
+      rebase = {
+        autoStash = true;
+        autoSquash = true;
+      };
+      init = {
+        defaultBranch = "prime";
+      };
+      user = {
+        name = "Benedikt Peetz";
+        email = "benedikt.peetz@b-peetz.de";
+        # signingKey = "[is down below]";
+      };
+      help = {
+        autocorrect = 5;
+      };
+      push = {
+        gpgSign = "if-asked";
+      };
+      commit = {
+        template = "${gitTemplateFile}";
+      };
+      diff = {
+        colorMoved = "default";
+        # Usually leads to better results
+        algorithm = "patience";
+        bin = {
+          textconv = "hexdump -v -C";
+        };
+      };
+      # Makes it a bit more readable
+      blame = {
+        coloring = "repeatedLines";
+        markIgnoredLines = true;
+        markUnblamables = true;
+      };
+      merge = {
+        conflictstyle = "zdiff3";
+      };
+      url = {
+        "git@codeberg.org:" = {
+          insteadOf = "@cb:";
+        };
+        "https://codeberg.org/" = {
+          insteadOf = "cb://";
+        };
+
+        "git@github.com:" = {
+          insteadOf = "@gh:";
+        };
+        "https://github.com/" = {
+          insteadOf = "gh://";
+        };
+
+        "git@gitlab.com:" = {
+          insteadOf = "@gl:";
+        };
+        "https://gitlab.com/" = {
+          insteadOf = "gl://";
+        };
+      };
+    };
+    delta = {
+      enable = true;
+      options = {
+        decorations = {
+          commit-decoration-style = "bold yellow box ul";
+          file-decoration-style = "none";
+          file-style = "bold yellow ul";
+        };
+        keep-plus-minus-markers = true;
+        features = "decorations";
+        whitespace-error-style = "22 reverse";
+      };
+    };
+    signing = {
+      key = "8321ED3A8DB999A51F3BF80FF2682914EA42DE26";
+      signByDefault = true;
+    };
+  };
+}