about summary refs log tree commit diff stats
path: root/hm/soispha/conf/git/default.nix
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-08-26 23:42:21 +0200
committerSoispha <soispha@vhack.eu>2023-08-26 23:42:21 +0200
commit3f600ab07dbad3b6dd7655587ddea158b19aea71 (patch)
tree7164ccd965e1d14ade970aeb8eb188b1442a6c91 /hm/soispha/conf/git/default.nix
parentStyle(treewide): Format all lua-files makes lua ➛ nix easier (diff)
downloadnixos-config-3f600ab07dbad3b6dd7655587ddea158b19aea71.zip
Refactor(treewide): Abbreviate path names
Diffstat (limited to 'hm/soispha/conf/git/default.nix')
-rw-r--r--hm/soispha/conf/git/default.nix90
1 files changed, 90 insertions, 0 deletions
diff --git a/hm/soispha/conf/git/default.nix b/hm/soispha/conf/git/default.nix
new file mode 100644
index 00000000..f99f705c
--- /dev/null
+++ b/hm/soispha/conf/git/default.nix
@@ -0,0 +1,90 @@
+{
+  lib,
+  nixosConfig,
+  ...
+}: 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 = {
+      st = "status";
+      ds = "diff --staged";
+      di = "diff";
+      rs = "restore --staged";
+
+      ## Logging:
+      ls = "log --max-count=10 --color --format=format:'%C(bold red)%h%C(reset) %C(dim bold blue)%s%C(reset) %C(dim white)[%aN] %C(bold red)<%G?>%C(reset)%C(auto)%d%C(reset)'";
+
+      # https://stackoverflow.com/a/61487052
+      lg = "lg1";
+      lg1 = "lg1-specific --all";
+      lg2 = "lg2-specific --all";
+      lg3 = "lg3-specific --all";
+
+      lg1-specific = "log --graph --abbrev-commit --decorate \
+                      --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold cyan) [%G?]%C(reset)%C(auto)%d%C(reset)'";
+
+      lg2-specific = "log --graph --abbrev-commit --decorate \
+                      --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n''          %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'";
+
+      lg3-specific = "log --graph --abbrev-commit --decorate \
+                      --format=format:'%C(bold blue)%h%C(reset)\
+                      - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)\
+                      %C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)\
+                      %C(bold red)(signature: %G? by %GS, trust: %GT)%C(reset)%n\
+                      ''          %C(white)%s%C(reset)%n''\
+                      %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)\
+                      %C(bold white)- trailers: %(trailers) %C(reset)'";
+    };
+    extraConfig = {
+      core = {
+        excludesFile = "${gitIgnoreFile}";
+      };
+      init = {
+        defaultBranch = "prime";
+      };
+      user = {
+        email = "soispha@vhack.eu";
+        name = "Soispha";
+      };
+      help = {
+        autocorrect = 5;
+      };
+      push = {
+        gpgSign = "if-asked";
+      };
+      commit = {
+        template = "${gitTemplateFile}";
+      };
+      diff = {
+        colorMoved = "default";
+      };
+      merge = {
+        conflictstyle = "diff3";
+      };
+    };
+    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 =
+          if nixosConfig.soispha.laptop.enable
+          then true
+          else false;
+        features = "decorations";
+        whitespace-error-style = "22 reverse";
+      };
+    };
+    signing = {
+      key = "9606FC749FCE16360723D4ADA5E94010C3A642AD!";
+      signByDefault = true;
+    };
+  };
+}