git: configure patdiff through [patdiff] git section (#6978)
This adds the ability to enable the patdiff program as git differ. Website of the project: https://opensource.janestreet.com/patdiff/
This commit is contained in:
parent
50894120e8
commit
2ede089d11
5 changed files with 68 additions and 1 deletions
|
|
@ -496,6 +496,17 @@ in
|
|||
'';
|
||||
};
|
||||
};
|
||||
|
||||
patdiff = {
|
||||
enable = mkEnableOption "" // {
|
||||
description = ''
|
||||
Whether to enable the {command}`patdiff` differ.
|
||||
See <https://opensource.janestreet.com/patdiff/>
|
||||
'';
|
||||
};
|
||||
|
||||
package = mkPackageOption pkgs "patdiff" { };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -526,10 +537,11 @@ in
|
|||
cfg.difftastic.enable
|
||||
cfg.diff-highlight.enable
|
||||
cfg.riff.enable
|
||||
cfg.patdiff.enable
|
||||
];
|
||||
in
|
||||
lib.count lib.id enabled <= 1;
|
||||
message = "Only one of 'programs.git.delta.enable' or 'programs.git.difftastic.enable' or 'programs.git.diff-so-fancy.enable' or 'programs.git.diff-highlight' can be set to true at the same time.";
|
||||
message = "Only one of 'programs.git.delta.enable' or 'programs.git.difftastic.enable' or 'programs.git.diff-so-fancy.enable' or 'programs.git.diff-highlight' or 'programs.git.patdiff' can be set to true at the same time.";
|
||||
}
|
||||
];
|
||||
|
||||
|
|
@ -902,6 +914,20 @@ in
|
|||
}
|
||||
)
|
||||
|
||||
(
|
||||
let
|
||||
patdiffPackage = cfg.patdiff.package;
|
||||
patdiffCommand = "${lib.getExe' patdiffPackage "patdiff-git-wrapper"}";
|
||||
in
|
||||
mkIf cfg.patdiff.enable {
|
||||
home.packages = [ patdiffPackage ];
|
||||
|
||||
programs.git.iniContent = {
|
||||
diff.external = patdiffCommand;
|
||||
};
|
||||
}
|
||||
)
|
||||
|
||||
(mkIf (cfg.riff.enable && cfg.riff.commandLineOptions != "") {
|
||||
home.sessionVariables.RIFF = cfg.riff.commandLineOptions;
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue