syncthing: listOf -> attrsOf

This commit is contained in:
lassulus 2019-04-18 10:14:18 +02:00
parent e4744b7237
commit 3adcf3a74c

View File

@ -10,7 +10,7 @@ let
addresses = peer.addresses; addresses = peer.addresses;
}) cfg.peers; }) cfg.peers;
folders = map (folder: { folders = mapAttrsToList ( _: folder: {
inherit (folder) path id type; inherit (folder) path id type;
devices = map (peer: { deviceId = cfg.peers.${peer}.id; }) folder.peers; devices = map (peer: { deviceId = cfg.peers.${peer}.id; }) folder.peers;
rescanIntervalS = folder.rescanInterval; rescanIntervalS = folder.rescanInterval;
@ -81,17 +81,18 @@ in
}; };
folders = mkOption { folders = mkOption {
default = []; default = {};
type = types.listOf (types.submodule ({ config, ... }: { type = types.attrsOf (types.submodule ({ config, ... }: {
options = { options = {
path = mkOption { path = mkOption {
type = types.absolute-pathname; type = types.absolute-pathname;
default = config._module.args.name;
}; };
id = mkOption { id = mkOption {
type = types.str; type = types.str;
default = config.path; default = config._module.args.name;
}; };
peers = mkOption { peers = mkOption {