summary refs log tree commit diff stats
path: root/user/modules
diff options
context:
space:
mode:
authorAlan Pearce2019-10-02 23:32:01 +0200
committerAlan Pearce2019-10-02 23:43:46 +0200
commit01aa4a15598441d577525b6a160bdf1fe8fe183b (patch)
tree53b87027bd3410f00fcd15c923a037cfda34c087 /user/modules
parent1def90473958ef5288345b4d81ee0db990f09317 (diff)
downloadnixfiles-01aa4a15598441d577525b6a160bdf1fe8fe183b.tar.lz
nixfiles-01aa4a15598441d577525b6a160bdf1fe8fe183b.tar.zst
nixfiles-01aa4a15598441d577525b6a160bdf1fe8fe183b.zip
Migrate git config to home-manager
Diffstat (limited to 'user/modules')
-rw-r--r--user/modules/git.nix73
-rw-r--r--user/modules/satoshipay.nix19
2 files changed, 89 insertions, 3 deletions
diff --git a/user/modules/git.nix b/user/modules/git.nix
index a43ccadf..3c3f79bf 100644
--- a/user/modules/git.nix
+++ b/user/modules/git.nix
@@ -1,8 +1,75 @@
 { config, pkgs, ... }:
 
 {
-  xdg.configFile.git = {
-    recursive = true;
-    source = ../git/.config/git;
+  home.packages = with pkgs; [
+    gitAndTools.git-extras
+  ];
+  programs.git = {
+    enable = true;
+    userName = "Alan Pearce";
+    userEmail = "alan@alanpearce.eu";
+    extraConfig = {
+      pull = {
+        rebase = true;
+      };
+      push = {
+        default = "current";
+        followTags = true;
+      };
+      rebase = {
+        autosquash = true;
+      };
+      rerere = {
+        enable = true;
+      };
+      diff = {
+        algorithm = "patience";
+        tool = "icdiff";
+      };
+      difftool = {
+        prompt = false;
+      };
+      "difftool.icdiff" = {
+        cmd = "${pkgs.icdiff}/bin/icdiff --line-numbers $LOCAL $REMOTE";
+      };
+      "difftool.sopsdiffer" = {
+        textconf = "${pkgs.sops}/bin/sops -d";
+      };
+      "merge.npm-merge-driver" = {
+        name = "automatically merge npm lockfiles";
+        driver = "npx npm-merge-driver merge %A %O %B %P";
+      };
+      remote = {
+        autoSetupMerge = true;
+      };
+      "branch.master" = {
+        rebase = false;
+      };
+    };
+    signing = {
+      key = "0xCD4BEB92A8D46583";
+    };
+    lfs = {
+      enable = true;
+    };
+    aliases = {
+      up = "merge FETCH_HEAD";
+      st = "status -sb";
+      ci = "commit";
+      br = "branch";
+      co = "checkout";
+      lasttag = "!sh -c 'git tag --sort=version:refname | grep \"^v\\\\?[0-9]\" | tail -n1'";
+      pending = "!sh -c 'git log --oneline --grep=\"#\" ...$(git lasttag)'";
+      lg = "log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%cr) %C(bold blue)<%an> %Cred%d%Creset'";
+      prl = "log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%cr) %C(bold blue)<%an> %Cred%d%Creset'  --grep='#'";
+      ignored = "ls-files --others -i --exclude-standard";
+    };
+    ignores = [
+      ".DS_Store"
+      "*_flymake.*"
+      "*~"
+      "\#*\#"
+      ".\#*"
+    ];
   };
 }
diff --git a/user/modules/satoshipay.nix b/user/modules/satoshipay.nix
new file mode 100644
index 00000000..6feefbbb
--- /dev/null
+++ b/user/modules/satoshipay.nix
@@ -0,0 +1,19 @@
+{ config, pkgs, ... }:
+
+let
+  spGitConfig = {
+    user.email = "alan@satoshipay.io";
+  };
+in
+{
+  programs.git.includes = [
+    {
+      condition = "gitdir:~/projects/github.com/satoshipay/";
+      contents = spGitConfig;
+    }
+    {
+      condition = "gitdir:~/projects/gitlab.satoshipay.tech";
+      contents = spGitConfig;
+    }
+  ];
+}