diff --git a/modules/services/fnott.nix b/modules/services/fnott.nix index 5aaf525aa..d4e2addb4 100644 --- a/modules/services/fnott.nix +++ b/modules/services/fnott.nix @@ -8,15 +8,7 @@ let concatStringsSep' = sep: list: concatStringsSep sep (filter (x: x != "") list); - mkKeyValue = generators.mkKeyValueDefault { } "="; - genINI = generators.toINI { }; - - iniFormatType = with types; - let - iniAtom = types.nullOr (types.oneOf [ bool int float str ]) // { - description = "INI atom (null, bool, int, float or string)"; - }; - in attrsOf (attrsOf iniAtom); + iniFormat = pkgs.formats.ini { }; in { options = { services.fnott = { @@ -58,7 +50,7 @@ in { }; settings = mkOption { - type = iniFormatType; + type = iniFormat.type; default = { }; description = '' Configuration written to @@ -114,14 +106,7 @@ in { }; }; - xdg.configFile."fnott/fnott.ini" = { - # FIXME: Remove after next version release (https://codeberg.org/dnkl/fnott/pulls/24). - text = concatStringsSep' "\n" [ - (optionalString (cfg.settings ? main) '' - ${concatStringsSep "\n" (mapAttrsToList mkKeyValue cfg.settings.main)} - '') - (genINI (removeAttrs cfg.settings [ "main" ])) - ]; - }; + xdg.configFile."fnott/fnott.ini".source = + iniFormat.generate "fnott.ini" cfg.settings; }; } diff --git a/tests/modules/services/fnott/default.nix b/tests/modules/services/fnott/default.nix index 6b4bde383..e28250a48 100644 --- a/tests/modules/services/fnott/default.nix +++ b/tests/modules/services/fnott/default.nix @@ -1,5 +1,4 @@ { fnott-example-settings = ./example-settings.nix; - fnott-global-properties = ./global-properties.nix; fnott-systemd-user-service = ./systemd-user-service.nix; } diff --git a/tests/modules/services/fnott/example-settings-expected.ini b/tests/modules/services/fnott/example-settings-expected.ini index 153e456ca..6293f63d2 100644 --- a/tests/modules/services/fnott/example-settings-expected.ini +++ b/tests/modules/services/fnott/example-settings-expected.ini @@ -1,6 +1,7 @@ -notification-margin=5 - [low] timeout=5 title-color=ffffff title-font=Dina:weight=bold:slant=italic + +[main] +notification-margin=5 diff --git a/tests/modules/services/fnott/global-properties-expected.ini b/tests/modules/services/fnott/global-properties-expected.ini deleted file mode 100644 index a82646797..000000000 --- a/tests/modules/services/fnott/global-properties-expected.ini +++ /dev/null @@ -1,2 +0,0 @@ -max-icon-size=32 -notification-margin=5 diff --git a/tests/modules/services/fnott/global-properties.nix b/tests/modules/services/fnott/global-properties.nix deleted file mode 100644 index 3be88d787..000000000 --- a/tests/modules/services/fnott/global-properties.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ config, lib, pkgs, ... }: - -# FIXME: Deprecate on next version release of fnott (https://codeberg.org/dnkl/fnott/pulls/24). -{ - config = { - services.fnott = { - enable = true; - package = config.lib.test.mkStubPackage { }; - - settings = { - main = { - max-icon-size = 32; - notification-margin = 5; - }; - }; - }; - - nmt.script = '' - assertFileContent \ - home-files/.config/fnott/fnott.ini \ - ${./global-properties-expected.ini} - ''; - }; -}