diff options
author | Emery Hemingway <ehmry@posteo.net> | 2020-09-28 13:28:55 +0200 |
---|---|---|
committer | Emery Hemingway <ehmry@posteo.net> | 2020-09-28 14:38:31 +0200 |
commit | 9fa50bea7800c4adea330c881c6438875722db8d (patch) | |
tree | bf1cc0b96e42f42be97c02a252e23e82d9450d10 /nixos/modules/services/web-servers/molly-brown.nix | |
parent | 211ba8bfa3a27adb802c47fede7a0d0c6106017b (diff) |
nixos/molly-brown: refactor module to use a TOML generator
Diffstat (limited to 'nixos/modules/services/web-servers/molly-brown.nix')
-rw-r--r-- | nixos/modules/services/web-servers/molly-brown.nix | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/nixos/modules/services/web-servers/molly-brown.nix b/nixos/modules/services/web-servers/molly-brown.nix index e9052a184b2db..e0587f3b47163 100644 --- a/nixos/modules/services/web-servers/molly-brown.nix +++ b/nixos/modules/services/web-servers/molly-brown.nix @@ -4,23 +4,8 @@ with lib; let cfg = config.services.molly-brown; - - settingsType = with types; - attrsOf (oneOf [ - int - str - (listOf str) - (attrsOf (oneOf [ int str (listOf str) (attrsOf str) ])) - ]) // { - description = "primitive expression convertable to TOML"; - }; - - configFile = pkgs.runCommand "molly-brown.toml" { - buildInputs = [ pkgs.remarshal ]; - preferLocalBuild = true; - passAsFile = [ "settings" ]; - settings = builtins.toJSON cfg.settings; - } "remarshal -if json -of toml < $settingsPath > $out"; + settingsFormat = pkgs.formats.toml { }; + configFile = settingsFormat.generate "molly-brown.toml" cfg.settings; in { options.services.molly-brown = { @@ -76,7 +61,7 @@ in { }; settings = mkOption { - type = settingsType; + inherit (settingsFormat) type; default = { }; description = '' molly-brown configuration. Refer to |