2020-01-17 01:06:44 -08:00
|
|
|
{ config, lib, pkgs, ... }:
|
2019-08-06 10:56:54 -07:00
|
|
|
|
|
|
|
{
|
|
|
|
services.syncthing = {
|
|
|
|
enable = true;
|
|
|
|
openDefaultPorts = true;
|
2020-01-12 15:17:17 -08:00
|
|
|
user = config.my.username;
|
2020-01-15 15:19:34 -08:00
|
|
|
configDir = "/home/${config.my.username}/.config/syncthing";
|
|
|
|
dataDir = "/home/${config.my.username}/.local/share/syncthing";
|
|
|
|
declarative = {
|
|
|
|
devices = {
|
|
|
|
kuro.id = "4UJSUBN-V7LCISG-6ZE7SBN-YPXM5FQ-CE7CD2U-W4KZC7O-4HUZZSW-6DXAGQQ";
|
|
|
|
shiro.id = "G4DUO25-AMQQIWS-SRZE5TJ-43CCQZJ-5ULEZBS-P2LMZZU-V5JA5CS-6X7RLQK";
|
2020-01-17 01:06:44 -08:00
|
|
|
aka.id = "IZQ2GAC-I3QBTRT-TXBIG7Z-NT6S66Y-H64WOCO-T3AMKYZ-VGWTNCY-CTQOLQN";
|
2020-01-15 15:19:34 -08:00
|
|
|
ao.id = "PXKRUR4-EVTXROW-NHSEXBZ-H2NTNL7-EWOUDXF-P3AATC7-KATI37N-3YNQAQD";
|
|
|
|
# Windows machine; set up the other end yourself!
|
2020-01-17 01:06:44 -08:00
|
|
|
midori.id = "BOFH5JP-A3MPTJA-EGIZVWV-URHUTSJ-2ZXCAA2-XMZPPSR-GLMOQFL-ZX7DGQP";
|
2020-01-15 15:19:34 -08:00
|
|
|
};
|
|
|
|
folders =
|
2020-01-17 13:42:35 -08:00
|
|
|
let deviceEnabled = devices: lib.elem config.networking.hostName devices;
|
|
|
|
deviceType = devices:
|
|
|
|
if (deviceEnabled devices)
|
|
|
|
then "sendreceive"
|
|
|
|
else "receiveonly";
|
2020-01-15 15:19:34 -08:00
|
|
|
in {
|
|
|
|
archive = rec {
|
2020-01-17 01:06:44 -08:00
|
|
|
devices = [ "kuro" "ao" "midori" ];
|
2020-01-15 15:19:34 -08:00
|
|
|
path = "/home/${config.my.username}/archive";
|
|
|
|
watch = false;
|
2020-01-17 01:06:44 -08:00
|
|
|
rescanInterval = 3600 * 6;
|
2020-01-17 13:42:35 -08:00
|
|
|
type = deviceType ["kuro"];
|
|
|
|
enable = deviceEnabled devices;
|
2020-01-17 01:06:44 -08:00
|
|
|
};
|
|
|
|
share = rec {
|
|
|
|
devices = [ "kuro" "shiro" "ao" "aka" "midori" ];
|
|
|
|
path = "/home/${config.my.username}/share";
|
|
|
|
watch = true;
|
|
|
|
rescanInterval = 3600 * 6;
|
2020-01-17 13:42:35 -08:00
|
|
|
enable = deviceEnabled devices;
|
2020-01-15 15:19:34 -08:00
|
|
|
};
|
|
|
|
projects = rec {
|
2020-01-17 01:06:44 -08:00
|
|
|
devices = [ "kuro" "shiro" "ao" "midori" ];
|
2020-01-15 15:19:34 -08:00
|
|
|
path = "/home/${config.my.username}/projects";
|
|
|
|
watch = false;
|
2020-01-17 01:06:44 -08:00
|
|
|
rescanInterval = 3600 * 2;
|
2020-01-17 13:42:35 -08:00
|
|
|
type = deviceType ["ao"];
|
|
|
|
enable = deviceEnabled devices;
|
2020-01-15 15:19:34 -08:00
|
|
|
};
|
|
|
|
secrets = rec {
|
|
|
|
devices = [ "kuro" "shiro" "ao" "aka" ];
|
|
|
|
path = "/home/${config.my.username}/.secrets";
|
2020-01-17 01:06:44 -08:00
|
|
|
watch = true;
|
|
|
|
rescanInterval = 3600;
|
2020-01-17 13:42:35 -08:00
|
|
|
type = deviceType ["kuro" "shiro"];
|
|
|
|
enable = deviceEnabled devices;
|
2020-01-15 15:19:34 -08:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2019-08-06 10:56:54 -07:00
|
|
|
};
|
|
|
|
}
|