Commit 985c537

HPCesia <me@hpcesia.com>
2025-10-03 18:30:39
refactor: migrate git and jujutsu config
1 parent b292861
Changed files (4)
home
base
modules
home/base/core/git.nix
@@ -1,68 +0,0 @@
-{
-  config,
-  lib,
-  pkgs,
-  myvars,
-  ...
-}: {
-  # `programs.git` will generate the config file: ~/.config/git/config
-  # to make git use this config file, `~/.gitconfig` should not exist!
-  #
-  #    https://git-scm.com/docs/git-config#Documentation/git-config.txt---global
-  home.activation.removeExistingGitconfig = lib.hm.dag.entryBefore ["checkLinkTargets"] ''
-    rm -f ${config.home.homeDirectory}/.gitconfig
-  '';
-
-  programs.git = {
-    enable = true;
-    lfs.enable = true;
-
-    userName = myvars.userfullname;
-    userEmail = myvars.useremail;
-
-    extraConfig = {
-      init.defaultBranch = "main";
-      trim.bases = "develop,master,main"; # for git-trim
-      push.autoSetupRemote = true;
-      pull.rebase = true;
-
-      # replace https with ssh
-      url = {
-        "ssh://git@github.com/HPCesia" = {
-          insteadOf = "https://github.com/HPCesia";
-        };
-        "ssh://git@codeberg.org/HPCesia" = {
-          insteadOf = "https://codeberg.org/HPCesia";
-        };
-        "ssh://git@repo.hpcesia.com:2233/HPCesia" = {
-          insteadOf = "https://repo.hpcesia.com/HPCesia";
-        };
-      };
-    };
-
-    # A syntax-highlighting pager in Rust(2019 ~ Now)
-    delta = {
-      enable = true;
-      options = {
-        diff-so-fancy = true;
-        line-numbers = true;
-        true-color = "always";
-      };
-    };
-  };
-
-  programs.jujutsu = {
-    enable = true;
-    settings = {
-      user = {
-        name = myvars.userfullname;
-        email = myvars.useremail;
-      };
-      ui = {
-        editor = "hx";
-        diff-formatter = "delta";
-      };
-      merge-tools.delta.diff-expected-exit-codes = [0 1];
-    };
-  };
-}
home/base/gui/git.nix
@@ -1,11 +0,0 @@
-{...}: {
-  programs.git.signing = {
-    signByDefault = true;
-    format = "openpgp";
-  };
-
-  programs.jujutsu.settings.signing = {
-    behavior = "own";
-    backend = "gpg";
-  };
-}
modules/dev/git.nix
@@ -0,0 +1,58 @@
+{
+  flake.modules.homeManager.dev = {
+    config,
+    lib, # Use inner lib for home-manager's overlay
+    ...
+  }: {
+    # `programs.git` will generate the config file: ~/.config/git/config
+    # to make git use this config file, `~/.gitconfig` should not exist!
+    #
+    #    https://git-scm.com/docs/git-config#Documentation/git-config.txt---global
+    home.activation.removeExistingGitconfig = lib.hm.dag.entryBefore ["checkLinkTargets"] ''
+      rm -f ${config.home.homeDirectory}/.gitconfig
+    '';
+
+    programs.git = {
+      enable = true;
+      lfs.enable = true;
+
+      userName = "HPCesia";
+      userEmail = "me@hpcesia.com";
+
+      signing = {
+        signByDefault = true;
+        format = "openpgp";
+      };
+
+      extraConfig = {
+        init.defaultBranch = "main";
+        trim.bases = "develop,master,main"; # for git-trim
+        push.autoSetupRemote = true;
+        pull.rebase = true;
+
+        # replace https with ssh
+        url = {
+          "ssh://git@github.com/HPCesia" = {
+            insteadOf = "https://github.com/HPCesia";
+          };
+          "ssh://git@codeberg.org/HPCesia" = {
+            insteadOf = "https://codeberg.org/HPCesia";
+          };
+          "ssh://git@repo.hpcesia.com:2233/HPCesia" = {
+            insteadOf = "https://repo.hpcesia.com/HPCesia";
+          };
+        };
+      };
+
+      # A syntax-highlighting pager in Rust(2019 ~ Now)
+      delta = {
+        enable = true;
+        options = {
+          diff-so-fancy = true;
+          line-numbers = true;
+          true-color = "always";
+        };
+      };
+    };
+  };
+}
modules/dev/jujutsu.nix
@@ -0,0 +1,22 @@
+{
+  flake.modules.homeManager.dev = _: {
+    programs.jujutsu = {
+      enable = true;
+      settings = {
+        user = {
+          name = "HPCesia";
+          email = "me@hpcesia.com";
+        };
+        ui = {
+          editor = "hx";
+          diff-formatter = "delta";
+        };
+        merge-tools.delta.diff-expected-exit-codes = [0 1];
+        signing = {
+          behavior = "own";
+          backend = "gpg";
+        };
+      };
+    };
+  };
+}