From 9fa50bea7800c4adea330c881c6438875722db8d Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Mon, 28 Sep 2020 13:28:55 +0200 Subject: [PATCH] nixos/molly-brown: refactor module to use a TOML generator --- .../services/web-servers/molly-brown.nix | 21 +++---------------- 1 file 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 e9052a184b2..e0587f3b471 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