diff options
Diffstat (limited to 'modules/user/aszlig/programs/git')
-rw-r--r-- | modules/user/aszlig/programs/git/default.nix | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/modules/user/aszlig/programs/git/default.nix b/modules/user/aszlig/programs/git/default.nix index b4c1d9a4..8a497bd7 100644 --- a/modules/user/aszlig/programs/git/default.nix +++ b/modules/user/aszlig/programs/git/default.nix @@ -4,7 +4,6 @@ let inherit (lib) types; cfg = config.vuizvui.user.aszlig.programs.git; - gitPatched = pkgs.gitFull.overrideAttrs (git: { makeFlags = let oldFlags = git.makeFlags or []; @@ -13,6 +12,18 @@ let then oldFlags ++ [ newVal ] else "${oldFlags} ${newVal}"; }); + + libgit2Patched = pkgs.libgit2.overrideAttrs (drv: { + postPatch = (drv.postPatch or "") + '' + substituteInPlace src/sysdir.c \ + --replace '"/etc"' ${lib.escapeShellArg "\"${cfg.configFile}\""} + ''; + }); + + deltaPatched = pkgs.delta.overrideAttrs (drv: { + buildInputs = (drv.buildInputs or []) ++ lib.singleton libgit2Patched; + }); + in { options.vuizvui.user.aszlig.programs.git = { enable = lib.mkEnableOption "Git"; @@ -25,6 +36,8 @@ in { ''; }; + delta.enable = lib.mkEnableOption "using delta for Git diff"; + settings = lib.mkOption { type = let scalar = types.oneOf [ types.bool types.int types.str ]; @@ -73,10 +86,17 @@ in { lines = lib.flatten (lib.mapAttrsToList mkConf cfg.settings); in pkgs.writeText "gitconfig" (joinLines lines); + vuizvui.user.aszlig.programs.git.settings = lib.mkIf cfg.delta.enable { + interactive.diffFilter = "delta --color-only"; + pager = lib.flip lib.genAttrs (lib.const "delta") [ + "diff" "log" "reflog" "show" + ]; + }; + environment.systemPackages = [ gitPatched pkgs.gitAndTools.git-remote-hg pkgs.gitAndTools.hub - ]; + ] ++ lib.optional cfg.delta.enable deltaPatched; }; } |