diff --git a/modules/programs/kitty.nix b/modules/programs/kitty.nix index e2a75fc7d..948448558 100644 --- a/modules/programs/kitty.nix +++ b/modules/programs/kitty.nix @@ -433,7 +433,7 @@ in ''; }; - xdg.configFile."kitty/diff.conf" = mkIf (cfg.diffConfig != { }) { + xdg.configFile."kitty/diff.conf" = mkIf (cfg.diffConfig.extraConfig != "") { text = '' # Generated by Home Manager # See https://sw.kovidgoyal.net/kitty/kittens/diff/ diff --git a/tests/modules/programs/kitty/default.nix b/tests/modules/programs/kitty/default.nix index 789650367..1c0fce415 100644 --- a/tests/modules/programs/kitty/default.nix +++ b/tests/modules/programs/kitty/default.nix @@ -5,4 +5,5 @@ kitty-example-mkOrder = ./example-mkOrder.nix; kitty-example-quickAccessTerminalConfig = ./example-quickAccessTerminalConfig.nix; kitty-auto-theme-files = ./auto-theme-files.nix; + kitty-example-diffConfig = ./example-diffConfig.nix; } diff --git a/tests/modules/programs/kitty/example-diffConfig-expected.conf b/tests/modules/programs/kitty/example-diffConfig-expected.conf new file mode 100644 index 000000000..6ff2ebcc1 --- /dev/null +++ b/tests/modules/programs/kitty/example-diffConfig-expected.conf @@ -0,0 +1,6 @@ +# Generated by Home Manager +# See https://sw.kovidgoyal.net/kitty/kittens/diff/ +diff_cmd auto + +map j scroll_by 1 + diff --git a/tests/modules/programs/kitty/example-diffConfig.nix b/tests/modules/programs/kitty/example-diffConfig.nix new file mode 100644 index 000000000..e2040a76b --- /dev/null +++ b/tests/modules/programs/kitty/example-diffConfig.nix @@ -0,0 +1,21 @@ +{ + config = { + programs.kitty = { + enable = true; + + diffConfig = { + settings.diff_cmd = "auto"; + keybindings = { + "j" = "scroll_by 1"; + }; + }; + }; + + nmt.script = '' + assertFileExists home-files/.config/kitty/diff.conf + assertFileContent \ + home-files/.config/kitty/diff.conf \ + ${./example-diffConfig-expected.conf} + ''; + }; +}