From f3b8160f2c87a5021b7c0c99a654f4279e5289f5 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Wed, 13 Mar 2019 21:36:35 +0000 Subject: modules/git: add JSON textconv --- modules/shell/git/attributes | 1 + modules/shell/git/config.in | 52 +++++++++++++++++++++++++++++++++++++++++++ modules/shell/git/config.nix | 52 ------------------------------------------- modules/shell/git/default.nix | 14 ++++++++++-- 4 files changed, 65 insertions(+), 54 deletions(-) create mode 100644 modules/shell/git/config.in delete mode 100644 modules/shell/git/config.nix (limited to 'modules/shell') diff --git a/modules/shell/git/attributes b/modules/shell/git/attributes index 6f33cd4e46e9..51037ea8c46a 100644 --- a/modules/shell/git/attributes +++ b/modules/shell/git/attributes @@ -1 +1,2 @@ +*.json diff=json *.plist diff=plist diff --git a/modules/shell/git/config.in b/modules/shell/git/config.in new file mode 100644 index 000000000000..ee4dcef4c1e1 --- /dev/null +++ b/modules/shell/git/config.in @@ -0,0 +1,52 @@ +[core] + attributesfile = @attributesfile@ + excludesfile = @ignorefile@ +[alias] + ignore = "!gi() { curl -L -s https://www.gitignore.io/api/$@ ;}; gi" + unbranch = "!git branch --sort -HEAD --merged | sed 1d | xargs git branch -d" +[push] + default = current +[merge] + conflictstyle = diff3 + tool = opendiff +[color "branch"] + current = yellow reverse + local = yellow + remote = green +[color "diff"] + meta = yellow bold + frag = magenta bold + old = red bold + new = green bold +[color "status"] + added = yellow + changed = green + untracked = cyan +[commit] + gpgsign = true + verbose = true +[help] + autocorrect = 1 +[filter "lfs"] + smudge = git-lfs smudge -- %f + required = true + clean = git-lfs clean -- %f +[diff] + compactionHeuristic = true + renameLimit = 0 + wsErrorHighlight = all +[credential] + helper = osxkeychain +[hub] + protocol = ssh +[branch] + autosetuprebase = always +[diff "json"] + textconv = @python@/bin/python -m json.tool +[diff "plist"] + textconv = /usr/bin/plutil -convert xml1 -o - +[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 diff --git a/modules/shell/git/config.nix b/modules/shell/git/config.nix deleted file mode 100644 index dc605551a18c..000000000000 --- a/modules/shell/git/config.nix +++ /dev/null @@ -1,52 +0,0 @@ -'' -[core] - attributesfile = ${./attributes} - excludesfile = ${./ignore} -[alias] - ignore = "!gi() { curl -L -s https://www.gitignore.io/api/$@ ;}; gi" - unbranch = "!git branch --sort -HEAD --merged | sed 1d | xargs git branch -d" -[push] - default = current -[merge] - conflictstyle = diff3 - tool = opendiff -[color "branch"] - current = yellow reverse - local = yellow - remote = green -[color "diff"] - meta = yellow bold - frag = magenta bold - old = red bold - new = green bold -[color "status"] - added = yellow - changed = green - untracked = cyan -[commit] - gpgsign = true - verbose = true -[help] - autocorrect = 1 -[filter "lfs"] - smudge = git-lfs smudge -- %f - required = true - clean = git-lfs clean -- %f -[diff] - compactionHeuristic = true - renameLimit = 0 - wsErrorHighlight = all -[credential] - helper = osxkeychain -[hub] - protocol = ssh -[branch] - autosetuprebase = always -[diff "plist"] - textconv = /usr/bin/plutil -convert xml1 -o - -[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 -'' diff --git a/modules/shell/git/default.nix b/modules/shell/git/default.nix index 56b7af620d4c..1257752e9967 100644 --- a/modules/shell/git/default.nix +++ b/modules/shell/git/default.nix @@ -1,8 +1,18 @@ { pkgs, ... }: +let + config = pkgs.runCommand "gitconfig" { + python = pkgs.python3; + attributesfile = ./attributes; + ignorefile = ./ignore; + preferLocalBuild = true; + } '' + substituteAll ${./config.in} $out + ''; + +in { environment.systemPackages = with pkgs; [ gitSVN ]; - xdg.config.users.qyliss.paths."git/config" = - pkgs.writeText "gitconfig" (import ./config.nix); + xdg.config.users.qyliss.paths."git/config" = config; } -- cgit 1.4.1