about summary refs log tree commit diff
path: root/modules/common/git.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2024-03-31 21:29:27 +0300
committerAzat Bahawi <azat@bahawi.net>2024-03-31 21:29:27 +0300
commit9a5427e3a0c0ccf2a82dc503149a26b23fbd6004 (patch)
treef28beec29deeea36038615a8fb98a810891940b5 /modules/common/git.nix
parent2024-03-19 (diff)
2024-03-31
Diffstat (limited to '')
-rw-r--r--modules/common/git.nix84
1 files changed, 45 insertions, 39 deletions
diff --git a/modules/common/git.nix b/modules/common/git.nix
index c6be614..fbe190e 100644
--- a/modules/common/git.nix
+++ b/modules/common/git.nix
@@ -6,11 +6,12 @@
   pkgs,
   ...
 }:
-with lib; let
+with lib;
+let
   cfg = config.nixfiles.modules.git;
-in {
-  options.nixfiles.modules.git.client.enable =
-    mkEnableOption "Git client";
+in
+{
+  options.nixfiles.modules.git.client.enable = mkEnableOption "Git client";
 
   config = mkIf cfg.client.enable {
     secrets = {
@@ -75,6 +76,8 @@ in {
                 autoStash = true;
                 autoSquash = true;
               };
+              rerere.enabled = true;
+              branch.sort = "-committerdate";
               diff = {
                 mnemonicPrefix = true;
                 renames = "copies";
@@ -89,51 +92,54 @@ in {
                 annotate = true;
                 confirm = "always";
               };
+              column.ui = "auto";
               github.user = my.username;
               gitlab.user = my.username;
             }
-            // mapAttrs'
-            (name: value: nameValuePair ''url "git@${value}:"'' {insteadOf = "${name}:";}) {
+            // mapAttrs' (name: value: nameValuePair ''url "git@${value}:"'' { insteadOf = "${name}:"; }) {
               "bitbucket" = "bitbucket.com";
               "codeberg" = "codeberg.org";
               "github" = "github.com";
               "gitlab" = "gitlab.com";
               "sourcehut" = "git.sr.ht";
             }
-            // mapAttrs'
-            (name: values: nameValuePair ''url "https://${values}/"'' {insteadOf = "${name}:";}) {
-              "alpine" = "gitlab.alpinelinux.org";
-              "debian" = "salsa.debian.org";
-              "freedesktop" = "gitlab.freedesktop.org";
-              "gnome" = "gitlab.gnome.org";
-              "haskell" = "gitlab.haskell.org";
-              "homotopic" = "gitlab.homotopic.tech";
-              "horizon" = "gitlab.horizon-haskell.net";
-              "kde" = "invent.kde.org";
-              "nixca" = "gitlab.nixca.dev";
-              "notabug" = "notabug.org";
-              "opencode" = "opencode.net";
-              "torproject" = "gitlab.torproject.org";
-              "videolan" = "code.videolan.org";
-            };
+            //
+              mapAttrs' (name: values: nameValuePair ''url "https://${values}/"'' { insteadOf = "${name}:"; })
+                {
+                  "alpine" = "gitlab.alpinelinux.org";
+                  "debian" = "salsa.debian.org";
+                  "freedesktop" = "gitlab.freedesktop.org";
+                  "gnome" = "gitlab.gnome.org";
+                  "haskell" = "gitlab.haskell.org";
+                  "homotopic" = "gitlab.homotopic.tech";
+                  "horizon" = "gitlab.horizon-haskell.net";
+                  "kde" = "invent.kde.org";
+                  "nixca" = "gitlab.nixca.dev";
+                  "notabug" = "notabug.org";
+                  "opencode" = "opencode.net";
+                  "torproject" = "gitlab.torproject.org";
+                  "videolan" = "code.videolan.org";
+                };
 
-          aliases = let
-            git = getExe config.hm.programs.git.package;
-            curl = getExe pkgs.curl;
-          in {
-            amend = "commit --amend";
-            cat = "cat-file -p";
-            fast = "clone --depth=1";
-            fixup = "commit --fixup";
-            fuck = "!${git} reset --hard && ${git} clean --force -dx";
-            get = "pull --all --recurse-submodules --autostash";
-            gud = ''commit -m "git gud"'';
-            refresh = "clean --force -dx";
-            tree = "log --graph --date=relative --pretty=tformat:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%an %ad)%Creset'";
-            uncommit = "reset --soft HEAD~1";
-            untrack = "rm --cache --";
-            wtc = "!${curl} -sq whatthecommit.com/index.txt | ${git} commit -F -";
-          };
+          aliases =
+            let
+              git = getExe config.hm.programs.git.package;
+              curl = getExe pkgs.curl;
+            in
+            {
+              amend = "commit --amend";
+              cat = "cat-file -p";
+              fast = "clone --depth=1";
+              fixup = "commit --fixup";
+              fuck = "!${git} reset --hard && ${git} clean --force -dx";
+              get = "pull --all --recurse-submodules --autostash";
+              gud = ''commit -m "git gud"'';
+              refresh = "clean --force -dx";
+              tree = "log --graph --date=relative --pretty=tformat:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%an %ad)%Creset'";
+              uncommit = "reset --soft HEAD~1";
+              untrack = "rm --cache --";
+              wtc = "!${curl} -sq whatthecommit.com/index.txt | ${git} commit -F -";
+            };
 
           # All helper tools/editor generated files should go here. This must be
           # kept void of any project-specific or residual files.

Consider giving Nix/NixOS a try! <3