diff --git a/modules/services/kanshi.nix b/modules/services/kanshi.nix index 2eda7487..80896628 100644 --- a/modules/services/kanshi.nix +++ b/modules/services/kanshi.nix @@ -38,9 +38,7 @@ let else throw "Unknown tags ${attrNames x}"; - directivesStr = '' - ${concatStringsSep "\n" (map tagToStr cfg.settings)} - ''; + directivesStr = concatStringsSep "\n" (map tagToStr cfg.settings); oldDirectivesStr = '' ${concatStringsSep "\n" @@ -332,11 +330,13 @@ in { { home.packages = [ cfg.package ]; - xdg.configFile."kanshi/config".text = - if cfg.profiles == { } && cfg.extraConfig == "" then - directivesStr - else - oldDirectivesStr; + xdg.configFile."kanshi/config" = let + generatedConfigStr = + if cfg.profiles == { } && cfg.extraConfig == "" then + directivesStr + else + oldDirectivesStr; + in mkIf (generatedConfigStr != "") { text = generatedConfigStr; }; systemd.user.services.kanshi = { Unit = { diff --git a/tests/modules/services/kanshi/new-configuration.conf b/tests/modules/services/kanshi/new-configuration.conf index 817f6632..5a11a528 100644 --- a/tests/modules/services/kanshi/new-configuration.conf +++ b/tests/modules/services/kanshi/new-configuration.conf @@ -16,4 +16,3 @@ profile { output "LVDS-1" enable exec echo "7 eight 9" } -