Home Gen67 @ 2025-10-31-00:44 by jonas@monolith
This commit is contained in:
parent
d5e924cc4c
commit
f7dd93d6d8
@ -21,6 +21,39 @@
|
||||
on_msg_command = cfg.daemon.onMsgCommand;
|
||||
};
|
||||
};
|
||||
|
||||
valueToString = val:
|
||||
if (builtins.typeOf val == "string")
|
||||
then "\"${val}\""
|
||||
else
|
||||
(
|
||||
if (builtins.typeOf val == "int")
|
||||
then "${toString val}"
|
||||
else
|
||||
(
|
||||
if (builtins.typeOf val == "bool")
|
||||
then
|
||||
(
|
||||
if val
|
||||
then "true"
|
||||
else "false"
|
||||
)
|
||||
else (abort "Expected string int or bool, got ${builtins.typeOf val} with value ${toString val}")
|
||||
)
|
||||
);
|
||||
|
||||
toTOML = attrs:
|
||||
lib.concatStrings (
|
||||
lib.attrValues (
|
||||
lib.mapAttrs (
|
||||
name: config: ''
|
||||
[${name}]
|
||||
${lib.concatStringsSep "\n" (lib.attrValues (lib.mapAttrs (k: v: "${k} = ${valueToString v}") config))}
|
||||
''
|
||||
)
|
||||
attrs
|
||||
)
|
||||
);
|
||||
in {
|
||||
options.hive.gotify = {
|
||||
cli = {
|
||||
@ -107,10 +140,7 @@ in {
|
||||
};
|
||||
};
|
||||
sops.templates."gotify-daemon-toml" = {
|
||||
content = ''
|
||||
[gotify]
|
||||
${lib.generators.toKeyValue {} daemon-config.gotify}
|
||||
'';
|
||||
content = toTOML daemon-config;
|
||||
path = "${config.xdg.configHome}/gotify-desktop/config.toml";
|
||||
};
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user