git: add delta.package option

This makes it possible to conveniently customize the `delta` package.

PR #3897
This commit is contained in:
Sebastian Estrella 2023-04-19 23:41:38 -05:00 committed by Robert Helgesson
parent 5904f12d7d
commit e21ec3db17
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -310,6 +310,8 @@ in {
''; '';
}; };
package = mkPackageOption pkgs "delta" { };
options = mkOption { options = mkOption {
type = with types; type = with types;
let let
@ -538,11 +540,13 @@ in {
in { diff.external = difftCommand; }; in { diff.external = difftCommand; };
}) })
(mkIf cfg.delta.enable { (let
home.packages = [ pkgs.delta ]; deltaPackage = cfg.delta.package;
deltaCommand = "${deltaPackage}/bin/delta";
in mkIf cfg.delta.enable {
home.packages = [ deltaPackage ];
programs.git.iniContent = let deltaCommand = "${pkgs.delta}/bin/delta"; programs.git.iniContent = {
in {
core.pager = deltaCommand; core.pager = deltaCommand;
interactive.diffFilter = "${deltaCommand} --color-only"; interactive.diffFilter = "${deltaCommand} --color-only";
delta = cfg.delta.options; delta = cfg.delta.options;