From 012cfcc44ac920b53d424e6f7ac70436c5fcc58c Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Fri, 5 Dec 2025 23:05:16 -0600 Subject: [PATCH] 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 --- modules/programs/diff-highlight.nix | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/modules/programs/diff-highlight.nix b/modules/programs/diff-highlight.nix index 8bbe178b0..1c7ec048e 100644 --- a/modules/programs/diff-highlight.nix +++ b/modules/programs/diff-highlight.nix @@ -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 =