dotfiles/nixos/modules/services/syncthing/default.nix

65 lines
1.5 KiB
Nix
Raw Normal View History

{ flake, ... }:
let
inherit (flake.config.machines.devices)
2025-01-08 19:06:14 -06:00
synology
phone
tablet
;
inherit (flake.config.services.instances)
2025-01-08 19:06:14 -06:00
syncthing
web
;
2024-10-19 18:22:29 -05:00
service = syncthing;
localhost = web.localhost.address0;
in
{
2024-10-06 15:25:05 -05:00
services = {
syncthing = {
enable = true;
overrideDevices = false;
overrideFolders = false;
openDefaultPorts = true;
systemService = true;
2024-10-19 18:22:29 -05:00
guiAddress = "${localhost}:${toString service.ports.port0}";
2024-10-06 15:25:05 -05:00
settings = {
devices = {
2024-11-10 01:29:37 -06:00
${synology.name} = {
2024-10-06 15:25:05 -05:00
autoAcceptFolders = true;
2024-11-10 01:29:37 -06:00
name = synology.name;
2024-10-06 15:25:05 -05:00
addresses = [
2024-11-10 01:29:37 -06:00
"tcp://${synology.ip.address0}:${toString service.ports.port2}"
2024-10-06 15:25:05 -05:00
];
id = synology.sync.address0;
2024-10-06 15:25:05 -05:00
};
${phone.name} = {
autoAcceptFolders = true;
name = phone.name;
addresses = [
2024-10-19 18:22:29 -05:00
"tcp://${phone.ip.address0}:${toString service.ports.port2}"
2024-10-06 15:25:05 -05:00
];
id = phone.sync.address0;
2024-10-06 15:25:05 -05:00
};
${tablet.name} = {
autoAcceptFolders = true;
name = tablet.name;
addresses = [
2024-10-19 18:22:29 -05:00
"tcp://${tablet.ip.address0}:${toString service.ports.port2}"
2024-10-06 15:25:05 -05:00
];
id = tablet.sync.address0;
2024-10-06 15:25:05 -05:00
};
};
};
};
};
networking = {
firewall = {
allowedTCPPorts = [
2024-10-19 18:22:29 -05:00
service.ports.port0
service.ports.port1
service.ports.port2
2024-10-06 15:25:05 -05:00
];
};
};
}