dotfiles/nixos/modules/syncthing.nix

56 lines
1.4 KiB
Nix
Raw Normal View History

2024-10-06 15:25:05 -05:00
{flake, ...}: let
2024-10-19 18:22:29 -05:00
inherit (flake.config.system.device) nas phone tablet;
inherit (flake.config.service.instance) syncthing web;
service = syncthing;
localhost = web.localhost.address0;
2024-10-06 15:25:05 -05:00
in {
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 = {
${nas.name} = {
autoAcceptFolders = true;
name = nas.name;
addresses = [
2024-10-19 18:22:29 -05:00
"tcp://${nas.ip.address0}:${toString service.ports.port2}"
2024-10-06 15:25:05 -05:00
];
id = nas.sync;
};
${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;
};
${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;
};
};
};
};
};
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
];
};
};
}