about summary refs log tree commit diff
path: root/home/git/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'home/git/default.nix')
-rw-r--r--home/git/default.nix56
1 files changed, 56 insertions, 0 deletions
diff --git a/home/git/default.nix b/home/git/default.nix
new file mode 100644
index 0000000..7e6cd15
--- /dev/null
+++ b/home/git/default.nix
@@ -0,0 +1,56 @@
+{ lib, config, ... }:
+
+let cfg = config.my.home.git;
+in {
+  options.my.home.git = with lib; {
+    enable = mkEnableOption "git configuration";
+  };
+
+  config = lib.mkIf cfg.enable {
+    programs.git = {
+      enable = true;
+      aliases = {
+        s = "status --short --branch";
+        amend = "commit --amend --no-edit";
+      };
+      extraConfig = {
+        core.whitespace = "trailing-space,space-before-tab";
+        color.ui = "true";
+        push.default = "simple";
+        init.defaultBranch = "main";
+        branch.autosetuprebase = "remote";
+        branch.sort = "authordate";
+        commit.template = "${config.xdg.dataHome}/git/commit.template";
+      };
+      userName = "Franck Cuny";
+      userEmail = "franck@fcuny.net";
+      extraConfig = {
+        "credential \"https://github.com\"" = { username = "fcuny"; };
+        "credential \"https://git.fcuny.net\"" = { username = "fcuny"; };
+        "credential \"https://cl.fcuny.net\"" = { username = "fcuny"; };
+      };
+      ignores = [
+        "*.elc"
+        "*.iml"
+        "*.o"
+        "*.pyc"
+        "*.pyo"
+        "*pyc"
+        "*~"
+        ".DS_Store"
+        ".\\#"
+        ".dir-locals.el"
+        ".direnv/*"
+        ".idea"
+        ".projectile"
+        ".pytest_cache/"
+        "/env/*"
+        "Icon"
+        "TAGS"
+        "\\#*\\#"
+        "tags"
+      ];
+    };
+    xdg.dataFile."git/commit.template" = { source = ./commit.template; };
+  };
+}