mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 21:19:45 +01:00
git: add option to use riff as diff tool
https://github.com/walles/riff
This commit is contained in:
parent
a42fa14b53
commit
9ee6e4aad7
1 changed files with 44 additions and 0 deletions
|
@ -405,6 +405,29 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
riff = {
|
||||||
|
enable = mkEnableOption "" // {
|
||||||
|
description = ''
|
||||||
|
Enable the <command>riff</command> diff highlighter.
|
||||||
|
See <link xlink:href="https://github.com/walles/riff" />.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
package = mkPackageOption pkgs "riffdiff" { };
|
||||||
|
|
||||||
|
commandLineOptions = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [ ];
|
||||||
|
example = literalExpression ''[ "--no-adds-only-special" ]'';
|
||||||
|
apply = concatStringsSep " ";
|
||||||
|
description = ''
|
||||||
|
Command line arguments to include in the <command>RIFF</command> environment variable.
|
||||||
|
|
||||||
|
Run <command>riff --help</command> for a full list of options
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -418,6 +441,7 @@ in {
|
||||||
cfg.diff-so-fancy.enable
|
cfg.diff-so-fancy.enable
|
||||||
cfg.difftastic.enable
|
cfg.difftastic.enable
|
||||||
cfg.diff-highlight.enable
|
cfg.diff-highlight.enable
|
||||||
|
cfg.riff.enable
|
||||||
];
|
];
|
||||||
in count id enabled <= 1;
|
in count id enabled <= 1;
|
||||||
message =
|
message =
|
||||||
|
@ -636,5 +660,25 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(let riffExe = baseNameOf (getExe cfg.riff.package);
|
||||||
|
in mkIf cfg.riff.enable {
|
||||||
|
home.packages = [ cfg.riff.package ];
|
||||||
|
|
||||||
|
# https://github.com/walles/riff/blob/b17e6f17ce807c8652bc59cd46758661d23ce358/README.md#usage
|
||||||
|
programs.git.iniContent = {
|
||||||
|
pager = {
|
||||||
|
diff = riffExe;
|
||||||
|
log = riffExe;
|
||||||
|
show = riffExe;
|
||||||
|
};
|
||||||
|
|
||||||
|
interactive.diffFilter = "${riffExe} --color=on";
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
(mkIf (cfg.riff.enable && cfg.riff.commandLineOptions != "") {
|
||||||
|
home.sessionVariables.RIFF = cfg.riff.commandLineOptions;
|
||||||
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue