about summary refs log tree commit diff stats
path: root/home-manager/soispha/config/git
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-08-01 15:31:42 +0200
committerSoispha <soispha@vhack.eu>2023-08-01 15:42:54 +0200
commit0a608bd781dcda40144097b007fac0a0c60a8ee1 (patch)
treee69fbc1fd0e15e3b86f31f47b776df21f6f0170d /home-manager/soispha/config/git
parentFix(hm/conf/gammastep): Use lighter settings on laptops (diff)
downloadnixos-config-0a608bd781dcda40144097b007fac0a0c60a8ee1.zip
Refactor(treewide): Move module configuration in separate files
Diffstat (limited to 'home-manager/soispha/config/git')
-rw-r--r--home-manager/soispha/config/git/default.nix76
-rw-r--r--home-manager/soispha/config/git/git_ignore.git4
-rw-r--r--home-manager/soispha/config/git/git_template.git66
3 files changed, 146 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;
+    };
+  };
+}
diff --git a/home-manager/soispha/config/git/git_ignore.git b/home-manager/soispha/config/git/git_ignore.git
new file mode 100644
index 00000000..8f29815e
--- /dev/null
+++ b/home-manager/soispha/config/git/git_ignore.git
@@ -0,0 +1,4 @@
+# default nvim Session file name
+Session.vim
+
+# vim: ft=gitignore
diff --git a/home-manager/soispha/config/git/git_template.git b/home-manager/soispha/config/git/git_template.git
new file mode 100644
index 00000000..9621698d
--- /dev/null
+++ b/home-manager/soispha/config/git/git_template.git
@@ -0,0 +1,66 @@
+
+# Title: Summary, imperative, start upper case, don't end with a period
+# If applied, this commit will <your Title>
+
+# Body: Explain *what* and *why* (not *how*).
+
+
+# BREAKING CHANGE: <description>
+# Fixes: #
+# Refs: #
+# Co-authored-by: <name> <email>
+
+
+
+# Convention Commits (https://www.conventionalcommits.org/en/v1.0.0/ or https://github.com/angular/angular/blob/85b4941be137a2fcdc664dc870e408dd72ad7de7/CONTRIBUTING.md#commit):
+#  Feat: [Features] -> MINOR version bump
+#      A new feature
+#
+#  Fix: [Bug Fixes] -> PATCH version bump
+#      A bug fix
+#
+#  append '!' after the type/scope: [Breaking Change] -> MAJOR version bump
+#      A breaking API change
+#
+#  Docs: [Documentation]
+#      Documentation only changes
+#
+#  Style: [Styles]
+#      Changes that do not affect the meaning of the code
+#      (white-space, formatting, missing semi-colons, etc)
+#
+#  Refactor: [Code Refactoring]
+#      A code change that neither fixes a bug nor adds a feature
+#
+#  Perf: [Performance Improvements] -> PATCH version bump
+#      A code change that improves performance
+#
+#  Test: [Tests]
+#      Adding missing tests or correcting existing tests
+#
+#  Build: [Builds] -> PATCH version bump
+#      Changes that affect the build system or external dependencies
+#      (example scopes: gulp, broccoli, npm)
+#
+#  Ci: [Continuous Integrations]
+#      Changes to our CI configuration files and scripts
+#      (example scopes: Travis, Circle, BrowserStack, SauceLabs)
+#
+#  Chore: [Chores]
+#      Other changes that don't modify src or test files
+#
+#  Reverts: [Reverts]
+#      Reverts a previous commit
+
+# How to Write a Git Commit Message:
+# [https://chris.beams.io/posts/git-commit/] -> https://cbea.ms/git-commit/
+#
+# 1. Separate subject from body with a blank line
+# 2. Limit the subject line to 50 characters
+# 3. Capitalize the subject line
+# 4. Do not end the subject line with a period
+# 5. Use the imperative mood in the subject line
+# 6. Wrap the body at 72 characters
+# 7. Use the body to explain *what* and *why* vs. *how*
+#
+# vim: ft=gitcommit