about summary refs log tree commit diff stats
path: root/home-manager/soispha/config/git/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'home-manager/soispha/config/git/default.nix')
-rw-r--r--home-manager/soispha/config/git/default.nix76
1 files changed, 76 insertions, 0 deletions
diff --git a/home-manager/soispha/config/git/default.nix b/home-manager/soispha/config/git/default.nix
new file mode 100644
index 00000000..9e15da1d
--- /dev/null
+++ b/home-manager/soispha/config/git/default.nix
@@ -0,0 +1,76 @@
+{...}: 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}";
+      };
+    };
+    delta = {
+      enable = true;
+      options = {
+        decorations = {
+          commit-decoration-style = "bold yellow box ul";
+          file-decoration-style = "none";
+          file-style = "bold yellow ul";
+        };
+        features = "decorations";
+        whitespace-error-style = "22 reverse";
+      };
+    };
+    signing = {
+      key = "9606FC749FCE16360723D4ADA5E94010C3A642AD!";
+      signByDefault = true;
+    };
+  };
+}