mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 15:11: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;
|
default = 8384;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
folders = lib.mkOption {
|
||||||
|
type = lib.types.nonEmptyListOf lib.types.nonEmptyStr;
|
||||||
|
default = [
|
||||||
|
"Documents"
|
||||||
|
"Downloads"
|
||||||
|
"Music"
|
||||||
|
"Pictures"
|
||||||
|
"Projects"
|
||||||
|
"Videos"
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
|
@ -101,24 +112,11 @@ in
|
||||||
);
|
);
|
||||||
|
|
||||||
folders =
|
folders =
|
||||||
let
|
cfg.folders
|
||||||
genFolders =
|
|
||||||
folders:
|
|
||||||
folders
|
|
||||||
|> lib'.genAttrs (name: {
|
|> lib'.genAttrs (name: {
|
||||||
path = "${dataDir}/${name}";
|
path = "${dataDir}/${name}";
|
||||||
ignorePerms = false;
|
|
||||||
devices = config.services.syncthing.settings.devices |> lib.attrNames;
|
devices = config.services.syncthing.settings.devices |> lib.attrNames;
|
||||||
});
|
});
|
||||||
in
|
|
||||||
genFolders [
|
|
||||||
"Documents"
|
|
||||||
"Downloads"
|
|
||||||
"Music"
|
|
||||||
"Pictures"
|
|
||||||
"Projects"
|
|
||||||
"Videos"
|
|
||||||
];
|
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
listenAddress = "tcp://0.0.0.0:${toString cfg.syncPort}";
|
listenAddress = "tcp://0.0.0.0:${toString cfg.syncPort}";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue