git.nix (1996B)
1 { config, lib, pkgs, ... }: 2 3 with lib; 4 let 5 cfg = config.profiles.git; 6 in 7 { 8 options = { 9 profiles.git = { 10 enable = mkEnableOption "Enable git profile"; 11 }; 12 }; 13 config = mkIf cfg.enable { 14 environment.systemPackages = with pkgs; [ 15 gitAndTools.gitFull 16 gitAndTools.git-annex 17 gitAndTools.git-extras 18 ]; 19 environment.etc."gitconfig" = rec { 20 text = '' 21 [alias] 22 co = checkout 23 st = status 24 ci = commit --signoff 25 ca = commit --amend 26 b = branc --color -v 27 br = branch 28 unstage = reset HEAD 29 lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative 30 lga = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative --branches --remotes 31 lol = log --pretty=oneline --abbrev-commit --graph --decorate 32 conflicts = !git ls-files --unmerged | cut -c51- | sort -u | xargs $EDITOR 33 resolve = !git ls-files --unmerged | cut -c51- | sort -u | xargs git add 34 [color] 35 branch = auto 36 diff = auto 37 status = auto 38 [color "branch"] 39 current = cyan reverse 40 local = cyan 41 remote = green 42 [color "diff"] 43 meta = white reverse 44 frag = magenta reverse 45 old = red 46 new = green 47 [color "status"] 48 added = green 49 changed = yellow 50 untracked = red 51 [core] 52 #excludesfile = ~/.gitignore.global 53 [push] 54 default = matching 55 [merge] 56 tool = vimdiff 57 58 [user] 59 name = Vincent Demeester 60 email = vincent@sbr.pm 61 62 [http] 63 cookiefile = /home/vincent/.gitcookies 64 65 [url "git@github.com:"] 66 pushInsteadOf = git://github.com/ 67 ''; 68 }; 69 }; 70 }