nixos/molly-brown: refactor module to use a TOML generator
This commit is contained in:
parent
211ba8bfa3
commit
9fa50bea78
@ -4,23 +4,8 @@ with lib;
|
|||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.services.molly-brown;
|
cfg = config.services.molly-brown;
|
||||||
|
settingsFormat = pkgs.formats.toml { };
|
||||||
settingsType = with types;
|
configFile = settingsFormat.generate "molly-brown.toml" cfg.settings;
|
||||||
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";
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
options.services.molly-brown = {
|
options.services.molly-brown = {
|
||||||
@ -76,7 +61,7 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
settings = mkOption {
|
settings = mkOption {
|
||||||
type = settingsType;
|
inherit (settingsFormat) type;
|
||||||
default = { };
|
default = { };
|
||||||
description = ''
|
description = ''
|
||||||
molly-brown configuration. Refer to
|
molly-brown configuration. Refer to
|
||||||
|
Loading…
x
Reference in New Issue
Block a user