1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-07 17:41:03 +01:00

diff-highlight: add git package assertion

Git package can be made nullable now, but module is written with
expectation of its availability.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
Austin Horstman 2025-12-05 23:05:16 -06:00
parent 36817384a6
commit 012cfcc44a

View file

@ -68,8 +68,15 @@ in
in
lib.mkMerge [
(mkIf cfg.enable {
# Auto-enable git integration if programs.git.diff-highlight.enable was set to true
programs.diff-highlight.enableGitIntegration = lib.mkIf oldOptionEnabled (lib.mkOverride 1490 true);
assertions = [
{
assertion = !cfg.enableGitIntegration || config.programs.git.package != null;
message = ''
programs.diff-highlight.enableGitIntegration requires programs.git.package to be set.
Please set programs.git.package to a valid git package.
'';
}
];
warnings =
lib.optional
@ -77,9 +84,12 @@ in
cfg.enableGitIntegration && options.programs.diff-highlight.enableGitIntegration.highestPrio == 1490
)
"`programs.diff-highlight.enableGitIntegration` automatic enablement is deprecated. Please explicitly set `programs.diff-highlight.enableGitIntegration = true`.";
# Auto-enable git integration if programs.git.diff-highlight.enable was set to true
programs.diff-highlight.enableGitIntegration = lib.mkIf oldOptionEnabled (lib.mkOverride 1490 true);
})
(mkIf (cfg.enable && cfg.enableGitIntegration) {
(mkIf (cfg.enable && cfg.enableGitIntegration && config.programs.git.package != null) {
programs.git = {
enable = lib.mkDefault true;
iniContent =