syncthing: Refactor folder config

This commit is contained in:
SebastianStork 2025-12-10 15:11:36 +01:00
parent 25f4536bb3
commit e63e374731
Signed by: SebastianStork
SSH key fingerprint: SHA256:iEM011ogNMG1q8+U500adGu/9rpPuZ2KnFtbdLeqTiI

View file

@ -35,6 +35,17 @@ in
default = 8384;
};
};
folders = lib.mkOption {
type = lib.types.nonEmptyListOf lib.types.nonEmptyStr;
default = [
"Documents"
"Downloads"
"Music"
"Pictures"
"Projects"
"Videos"
];
};
};
config = lib.mkIf cfg.enable {
@ -101,24 +112,11 @@ in
);
folders =
let
genFolders =
folders:
folders
cfg.folders
|> lib'.genAttrs (name: {
path = "${dataDir}/${name}";
ignorePerms = false;
devices = config.services.syncthing.settings.devices |> lib.attrNames;
});
in
genFolders [
"Documents"
"Downloads"
"Music"
"Pictures"
"Projects"
"Videos"
];
options = {
listenAddress = "tcp://0.0.0.0:${toString cfg.syncPort}";