Refactor syncthing config
And fix issue where folder types were set to null.
This commit is contained in:
parent
e16572976d
commit
d1cbda1c36
|
@ -17,38 +17,42 @@
|
||||||
midori.id = "BOFH5JP-A3MPTJA-EGIZVWV-URHUTSJ-2ZXCAA2-XMZPPSR-GLMOQFL-ZX7DGQP";
|
midori.id = "BOFH5JP-A3MPTJA-EGIZVWV-URHUTSJ-2ZXCAA2-XMZPPSR-GLMOQFL-ZX7DGQP";
|
||||||
};
|
};
|
||||||
folders =
|
folders =
|
||||||
let ifEnabledDevice = devices: lib.elem config.networking.hostName devices;
|
let deviceEnabled = devices: lib.elem config.networking.hostName devices;
|
||||||
|
deviceType = devices:
|
||||||
|
if (deviceEnabled devices)
|
||||||
|
then "sendreceive"
|
||||||
|
else "receiveonly";
|
||||||
in {
|
in {
|
||||||
archive = rec {
|
archive = rec {
|
||||||
devices = [ "kuro" "ao" "midori" ];
|
devices = [ "kuro" "ao" "midori" ];
|
||||||
path = "/home/${config.my.username}/archive";
|
path = "/home/${config.my.username}/archive";
|
||||||
watch = false;
|
watch = false;
|
||||||
rescanInterval = 3600 * 6;
|
rescanInterval = 3600 * 6;
|
||||||
type = lib.mkIf (! ifEnabledDevice ["kuro"]) "recieveonly";
|
type = deviceType ["kuro"];
|
||||||
enable = ifEnabledDevice devices;
|
enable = deviceEnabled devices;
|
||||||
};
|
};
|
||||||
share = rec {
|
share = rec {
|
||||||
devices = [ "kuro" "shiro" "ao" "aka" "midori" ];
|
devices = [ "kuro" "shiro" "ao" "aka" "midori" ];
|
||||||
path = "/home/${config.my.username}/share";
|
path = "/home/${config.my.username}/share";
|
||||||
watch = true;
|
watch = true;
|
||||||
rescanInterval = 3600 * 6;
|
rescanInterval = 3600 * 6;
|
||||||
enable = ifEnabledDevice devices;
|
enable = deviceEnabled devices;
|
||||||
};
|
};
|
||||||
projects = rec {
|
projects = rec {
|
||||||
devices = [ "kuro" "shiro" "ao" "midori" ];
|
devices = [ "kuro" "shiro" "ao" "midori" ];
|
||||||
path = "/home/${config.my.username}/projects";
|
path = "/home/${config.my.username}/projects";
|
||||||
watch = false;
|
watch = false;
|
||||||
rescanInterval = 3600 * 2;
|
rescanInterval = 3600 * 2;
|
||||||
type = lib.mkIf (ifEnabledDevice ["ao"]) "recieveonly";
|
type = deviceType ["ao"];
|
||||||
enable = ifEnabledDevice devices;
|
enable = deviceEnabled devices;
|
||||||
};
|
};
|
||||||
secrets = rec {
|
secrets = rec {
|
||||||
devices = [ "kuro" "shiro" "ao" "aka" ];
|
devices = [ "kuro" "shiro" "ao" "aka" ];
|
||||||
path = "/home/${config.my.username}/.secrets";
|
path = "/home/${config.my.username}/.secrets";
|
||||||
watch = true;
|
watch = true;
|
||||||
rescanInterval = 3600;
|
rescanInterval = 3600;
|
||||||
type = lib.mkIf (! ifEnabledDevice ["kuro" "shiro"]) "recieveonly";
|
type = deviceType ["kuro" "shiro"];
|
||||||
enable = ifEnabledDevice devices;
|
enable = deviceEnabled devices;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue