mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 11:41:34 +01:00
syncthing: Refactor folder config
This commit is contained in:
parent
25f4536bb3
commit
e63e374731
1 changed files with 16 additions and 18 deletions
|
|
@ -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
|
||||
|> lib'.genAttrs (name: {
|
||||
path = "${dataDir}/${name}";
|
||||
ignorePerms = false;
|
||||
devices = config.services.syncthing.settings.devices |> lib.attrNames;
|
||||
});
|
||||
in
|
||||
genFolders [
|
||||
"Documents"
|
||||
"Downloads"
|
||||
"Music"
|
||||
"Pictures"
|
||||
"Projects"
|
||||
"Videos"
|
||||
];
|
||||
cfg.folders
|
||||
|> lib'.genAttrs (name: {
|
||||
path = "${dataDir}/${name}";
|
||||
devices = config.services.syncthing.settings.devices |> lib.attrNames;
|
||||
});
|
||||
|
||||
options = {
|
||||
listenAddress = "tcp://0.0.0.0:${toString cfg.syncPort}";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue