diff --git a/modules/collections/server.nix b/modules/collections/server.nix index 9d51065..6f605fe 100644 --- a/modules/collections/server.nix +++ b/modules/collections/server.nix @@ -14,6 +14,7 @@ ../services/samba.nix ../services/ssh.nix ../services/step-ca.nix + #../services/syncthing.nix ../services/wireguard.nix ### Other Modules ### #../games/palworld.nix diff --git a/modules/services/syncthing.nix b/modules/services/syncthing.nix new file mode 100644 index 0000000..9d468fe --- /dev/null +++ b/modules/services/syncthing.nix @@ -0,0 +1,38 @@ +{ config, pkgs, lib, vars, ... }: +let + basePath = "/mnt/1tbssd/syncthing"; +in +{ + age.secrets.syncthing-key = { + file = ../../secrets/syncthing-key.age; + owner = "syncthing"; + group = "syncthing"; + }; + age.secrets.syncthing-cert = { + file = ../../secrets/syncthing-cert.age; + owner = "syncthing"; + group = "syncthing"; + }; + services.syncthing = { + enable = true; + dataDir = basePath; + openDefaultPorts = true; + cert = "/run/agenix/syncthing-cert"; + key = "/run/agenix/syncthing-key"; + guiAddress = "0.0.0.0:8384"; + + settings = { + options.urAccepted = -1; + options.relaysEnabled = false; + devices.kop-pc.id = "2IEILKO-R6UVES4-N27PZRT-YLPOPR3-LTD5SXA-C65FWF3-RYD2B2Y-PEZLTAR"; + devices.kop-pc.adresses = [ "tcp://192.168.0.11:51820"]; + + folders."~/sync" = { + id = "sync"; + devices = [ "kop-pc" ]; + }; + }; + }; + + networking.firewall.allowedTCPPorts = [ 8384 ]; +} diff --git a/secrets/secrets.nix b/secrets/secrets.nix index aaf3fbd..ef10587 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -22,4 +22,6 @@ in "kavita.age".publicKeys = [ nix-test-vm server kop ]; "step-ca-pw.age".publicKeys = [ nix-test-vm server kop ]; "step-ca-key.age".publicKeys = [ nix-test-vm server kop ]; + "syncthing-key.age".publicKeys = [ server kop ]; + "syncthing-cert.age".publicKeys = [ server kop ]; } diff --git a/secrets/syncthing-cert.age b/secrets/syncthing-cert.age new file mode 100644 index 0000000..ae005b4 Binary files /dev/null and b/secrets/syncthing-cert.age differ diff --git a/secrets/syncthing-key.age b/secrets/syncthing-key.age new file mode 100644 index 0000000..b3889ae Binary files /dev/null and b/secrets/syncthing-key.age differ