fixed lists of strings not being able to be converted to xml
This commit is contained in:
parent
99595ddfb5
commit
14d83dafcd
|
@ -21,6 +21,21 @@ in
|
||||||
mkIf cfg.enable
|
mkIf cfg.enable
|
||||||
(
|
(
|
||||||
let
|
let
|
||||||
|
listOfStrPrepass = xml: (builtins.mapAttrs (name: value:
|
||||||
|
(
|
||||||
|
if ((name == "content") && (builtins.isList value))
|
||||||
|
then
|
||||||
|
if (builtins.all builtins.isString value)
|
||||||
|
then # listOf str
|
||||||
|
(builtins.map (content: {
|
||||||
|
name = "string";
|
||||||
|
inherit content;
|
||||||
|
}))
|
||||||
|
else # Lis of something else
|
||||||
|
warnIf (!(builtins.all builtins.isAttrs value)) "Recieved list of mixed values. This will most likely not evaluate correctly" (listOfStrPrepass value)
|
||||||
|
else (listOfStrPrepass value)
|
||||||
|
)
|
||||||
|
xml));
|
||||||
toXml = name: x: (toXMLGeneric {
|
toXml = name: x: (toXMLGeneric {
|
||||||
inherit name;
|
inherit name;
|
||||||
properties = {
|
properties = {
|
||||||
|
@ -30,10 +45,13 @@ in
|
||||||
content = x;
|
content = x;
|
||||||
});
|
});
|
||||||
in {
|
in {
|
||||||
system.activationScripts."link-network-xml" =
|
system.activationScripts."link-network-xml" = lib.stringAfter ["var"] (
|
||||||
lib.stringAfter ["var"] (let content = toXml "NetworkConfiguration" cfg.network; in ''
|
let
|
||||||
|
content = toXml "NetworkConfiguration" (listOfStrPrepass cfg.network);
|
||||||
|
in ''
|
||||||
${pkgs.writeTextFile}/bin/writeTextFile /var/lib/jellyfin/config/network.xml '${strings.escape ["'"] content}'
|
${pkgs.writeTextFile}/bin/writeTextFile /var/lib/jellyfin/config/network.xml '${strings.escape ["'"] content}'
|
||||||
'');
|
''
|
||||||
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,15 @@ with lib; {
|
||||||
default = ["veth"];
|
default = ["veth"];
|
||||||
};
|
};
|
||||||
EnablePublishedServerUriByRequest = mkEnableOption "Enable published server uri by request";
|
EnablePublishedServerUriByRequest = mkEnableOption "Enable published server uri by request";
|
||||||
PublishedServerUriBySubnet = mkEnableOption "UNIMPLEMENTED";
|
PublishedServerUriBySubnet = mkOption {
|
||||||
|
type = with types; listOf str;
|
||||||
|
description = ''
|
||||||
|
Override the URI used by Jellyfin, based on the interface, or client IP address.
|
||||||
|
|
||||||
|
For example: `["internal=http://jellyfin.example.com" "external=https://jellyfin.example.com"]` or `["all=https://jellyfin.example.com"]`
|
||||||
|
'';
|
||||||
|
default = [];
|
||||||
|
};
|
||||||
RemoteIpFilter = mkOption {
|
RemoteIpFilter = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
description = "Remote ip filter";
|
description = "Remote ip filter";
|
||||||
|
|
Loading…
Reference in a new issue