diff --git a/modules/programs/wofi.nix b/modules/programs/wofi.nix index 53cfb1d35..699445ec6 100644 --- a/modules/programs/wofi.nix +++ b/modules/programs/wofi.nix @@ -42,11 +42,7 @@ in style = mkOption { default = null; - type = types.nullOr types.lines; - description = '' - CSS style for wofi to use as a stylesheet. See - {manpage}`wofi(7)`. - ''; + type = with types; nullOr (either lines path); example = '' * { font-family: monospace; @@ -56,6 +52,10 @@ in background-color: #7c818c; } ''; + description = '' + CSS style for wofi to use as a stylesheet. See + {manpage}`wofi(7)` + ''; }; }; @@ -70,7 +70,12 @@ in (mkIf (cfg.settings != { }) { "wofi/config".text = toConfig cfg.settings; }) - (mkIf (cfg.style != null) { "wofi/style.css".text = cfg.style; }) + ( + let + styleFile = if lib.isString cfg.style then pkgs.writeText "wofi-style" cfg.style else cfg.style; + in + mkIf (cfg.style != null) { "wofi/style.css".source = styleFile; } + ) ]; }; } diff --git a/tests/modules/programs/wofi/default.nix b/tests/modules/programs/wofi/default.nix index f06667b0f..c37a62b5f 100644 --- a/tests/modules/programs/wofi/default.nix +++ b/tests/modules/programs/wofi/default.nix @@ -1,4 +1,5 @@ { wofi-basic-configuration = ./basic-configuration.nix; wofi-empty-configuration = ./empty-configuration.nix; + wofi-style-local-file = ./style-local-file.nix; } diff --git a/tests/modules/programs/wofi/style-local-file.nix b/tests/modules/programs/wofi/style-local-file.nix new file mode 100644 index 000000000..b6b462cff --- /dev/null +++ b/tests/modules/programs/wofi/style-local-file.nix @@ -0,0 +1,12 @@ +{ + programs.wofi = { + enable = true; + style = ./basic-style.css; + }; + + nmt.script = '' + assertFileExists home-files/.config/wofi/style.css + assertFileContent home-files/.config/wofi/style.css \ + ${./basic-style.css} + ''; +}