about summary refs log tree commit diff
path: root/modules/shell/git
diff options
context:
space:
mode:
Diffstat (limited to 'modules/shell/git')
-rw-r--r--modules/shell/git/attributes2
-rw-r--r--modules/shell/git/config.in50
-rw-r--r--modules/shell/git/default.nix32
-rw-r--r--modules/shell/git/diff/mozlz4.in4
-rw-r--r--modules/shell/git/ignore27
5 files changed, 115 insertions, 0 deletions
diff --git a/modules/shell/git/attributes b/modules/shell/git/attributes
new file mode 100644
index 000000000000..57ea092a232a
--- /dev/null
+++ b/modules/shell/git/attributes
@@ -0,0 +1,2 @@
+*.json diff=json
+*.json.mozlz4 diff=mozlz4
diff --git a/modules/shell/git/config.in b/modules/shell/git/config.in
new file mode 100644
index 000000000000..2f682170c614
--- /dev/null
+++ b/modules/shell/git/config.in
@@ -0,0 +1,50 @@
+[alias]
+    ignore = "!gi() { curl -L -s https://www.gitignore.io/api/$@ ;}; gi"
+    unbranch = "!git branch --sort -HEAD --merged | sed 1d | xargs git branch -d"
+[branch]
+    autosetuprebase = always
+[color "branch"]
+    current = yellow reverse
+    local = yellow
+    remote = green
+[color "diff"]
+    frag = magenta bold
+    meta = yellow bold
+    new = green bold
+    old = red bold
+[color "status"]
+    added = yellow
+    changed = green
+    untracked = cyan
+[commit]
+    gpgsign = true
+    verbose = true
+[core]
+    attributesfile = @attributesfile@
+    excludesfile = @ignorefile@
+[credential]
+    helper = osxkeychain
+[diff]
+    compactionHeuristic = true
+    renameLimit = 0
+    wsErrorHighlight = all
+[diff "mozlz4"]
+    textconv = @mozlz4_textconv@
+[filter "lfs"]
+    clean = git-lfs clean -- %f
+    required = true
+    smudge = git-lfs smudge -- %f
+[format]
+    pretty = format:%Cred%h %C(magenta)%G? %Cgreen(%ar)%Creset -%C(bold red)%d%Creset %s %C(bold blue)<%aN>%Creset
+[grep]
+    lineNumber = true
+    patternType = perl
+[help]
+    autocorrect = 1
+[hub]
+    protocol = ssh
+[merge]
+    conflictstyle = diff3
+    tool = opendiff
+[push]
+    default = upstream
diff --git a/modules/shell/git/default.nix b/modules/shell/git/default.nix
new file mode 100644
index 000000000000..94a89b316275
--- /dev/null
+++ b/modules/shell/git/default.nix
@@ -0,0 +1,32 @@
+{ pkgs, ... }:
+
+let
+  mozlz4_textconv = pkgs.substituteAll {
+    src = diff/mozlz4.in;
+    isExecutable = true;
+
+    inherit (pkgs) execline mozlz4a;
+  };
+
+  config = pkgs.substituteAll {
+    src = ./config.in;
+
+    inherit mozlz4_textconv;
+    python = pkgs.python3;
+    attributesfile = ./attributes;
+    ignorefile = ./ignore;
+    preferLocalBuild = true;
+  };
+
+in
+{
+  imports = [ ../../xdg ];
+
+  environment.systemPackages = with pkgs; with gitAndTools; [
+    (git.override { svnSupport = true; sendEmailSupport = true; })
+    git-absorb
+    git-remote-hg
+  ];
+
+  users.users.qyliss.xdg.config.paths."git/config" = config;
+}
diff --git a/modules/shell/git/diff/mozlz4.in b/modules/shell/git/diff/mozlz4.in
new file mode 100644
index 000000000000..4377e69526c7
--- /dev/null
+++ b/modules/shell/git/diff/mozlz4.in
@@ -0,0 +1,4 @@
+#! @execline@/bin/execlineb -S1
+
+pipeline { @mozlz4a@/bin/mozlz4a -d $1 /dev/stdout }
+@python@/bin/python -m json.tool
diff --git a/modules/shell/git/ignore b/modules/shell/git/ignore
new file mode 100644
index 000000000000..bea5e703b81b
--- /dev/null
+++ b/modules/shell/git/ignore
@@ -0,0 +1,27 @@
+# macOS
+.DS_Store
+
+# Kakoune
+*.kak.*
+
+# Sublime Text
+sublime-project
+sublime-workspace
+
+# IntelliJ IDEA
+.idea
+*.iml
+
+# Bundler
+gem_graph.png
+
+# Direnv
+.envrc
+
+# ctags
+/tags
+
+# Emacs
+*~
+\#*\#
+.\#*
\ No newline at end of file