Files
nix-config/modules/services/syncthing.nix
2024-05-04 21:13:35 +02:00

73 lines
2.1 KiB
Nix

{ config, pkgs, lib, ... }:
let
basePath = "/synced";
in
{
systemd.tmpfiles.rules = [
"d ${basePath} 0700 ${config.mainUser.name} users -"
];
# check device id: syncthing cli --gui-address=/synced/gui-socket --gui-apikey=<key> show system
environment.systemPackages = with pkgs; [ syncthing ];
services.syncthing = {
enable = true;
dataDir = basePath;
user = config.mainUser.name;
group = "users";
guiAddress = "${basePath}/gui-socket";
overrideDevices = true;
overrideFolders = true;
settings = {
options.urAccepted = -1;
options.relaysEnabled = false;
options.globalAnnounceEnabled = false;
options.crashReportingEnabled = false;
devices = {
kop-pc = {
id = "DZKIUS7-WCGTYEV-4OKVSZU-MIVL2NC-N45AKZL-ABT3VN2-I7RXUMF-RF4CYAU";
addresses = [ "tcp://192.168.0.11" ];
};
server = {
id = "HZUUQEQ-JOKYHTU-AVFVC3U-7KUAXVC-QY3OJTF-HGU7RZ3-5HA5TOE-VT4FNQB";
addresses = [ "tcp://192.168.0.6" "tcp://192.168.2.1" ];
};
server = {
id = "HZUUQEQ-JOKYHTU-AVFVC3U-7KUAXVC-QY3OJTF-HGU7RZ3-5HA5TOE-VT4FNQB";
addresses = [ "tcp://192.168.0.10" "tcp://192.168.2.1" ];
};
laptop = {
id = "5T6Y3WO-FOQYYFQ-5MLNDSZ-7APIDUG-6KM2ZZM-RTRXMWX-MCZKLMH-BYNDJAQ";
addresses = [ "tcp://192.168.2.22" ];
};
};
folders."${basePath}/default" = {
id = "default";
devices = [ "kop-pc" "server" "laptop" "mini-pc" ];
ignorePerms = false;
};
folders."${basePath}/books" = {
id = "books";
devices = [ "kop-pc" "server" "laptop" "mini-pc" ];
};
folders."${basePath}/fh" = {
id = "fh";
devices = [ "kop-pc" "server" "laptop" "mini-pc" ];
};
folders."${basePath}/work_drive" = {
id = "work_drive";
devices = [ "kop-pc" "server" "laptop" "mini-pc" ];
};
};
};
networking.firewall.allowedTCPPorts = [ 8384 22000 ];
networking.firewall.allowedUDPPorts = [ 22000 21027 ];
}