nixos/tsm-client: Fix multi-value dsm.sys options

A configuration such as:

    programs.tsmClient.servers.backup.domain = [ "/dir1" "dir2" ];

...would previously result in an error ("cannot coerce a list to a
string"), since `makeDsmSysLines` would return a nested list.
This commit is contained in:
Lukas Werling 2024-07-16 23:38:14 +02:00
parent 693bc46d16
commit f52ee2af39

View File

@ -4,7 +4,7 @@ let optionsGlobal = options; in
let
inherit (lib.attrsets) attrNames attrValues mapAttrsToList removeAttrs;
inherit (lib.lists) all allUnique concatLists elem isList map;
inherit (lib.lists) all allUnique concatLists concatMap elem isList map;
inherit (lib.modules) mkDefault mkIf;
inherit (lib.options) mkEnableOption mkOption mkPackageOption;
inherit (lib.strings) concatLines match optionalString toLower;
@ -231,7 +231,7 @@ let
# Turn a key-value pair from the server options attrset
# into zero (value==null), one (scalar value) or
# more (value is list) configuration stanza lines.
if isList value then map (makeDsmSysLines key) value else # recurse into list
if isList value then concatMap (makeDsmSysLines key) value else # recurse into list
if value == null then [ ] else # skip `null` value
[ (" ${key}${
if value == true then "" else # just output key if value is `true`