summaryrefslogtreecommitdiff
path: root/sys/syncthing
diff options
context:
space:
mode:
Diffstat (limited to 'sys/syncthing')
-rw-r--r--sys/syncthing/default.nix45
1 files changed, 45 insertions, 0 deletions
diff --git a/sys/syncthing/default.nix b/sys/syncthing/default.nix
new file mode 100644
index 0000000..951ad30
--- /dev/null
+++ b/sys/syncthing/default.nix
@@ -0,0 +1,45 @@
+{
+ config,
+ lib,
+ ...
+}:
+with lib; let
+ cfg = config.local.syncthing;
+in {
+ options.local.syncthing = {
+ enable = mkEnableOption "syncthing server";
+ openFirewall = mkEnableOption "syncthing firewall rules";
+ };
+
+ config = mkMerge [
+ {
+ networking.firewall = {
+ allowedTCPPorts = optional cfg.openFirewall 22000;
+ allowedUDPPorts = optional cfg.openFirewall 22000;
+ };
+ }
+ (mkIf cfg.enable {
+ local.syncthing.openFirewall = true;
+
+ services.syncthing = {
+ enable = true;
+
+ systemService = true;
+ overrideFolders = false;
+ overrideDevices = false;
+ openDefaultPorts = true;
+
+ guiAddress = "127.0.0.1:8384";
+
+ settings.options.urAccepted = -1;
+
+ relay = {
+ enable = true;
+
+ pools = [];
+ providedBy = "${config.networking.hostName}.${config.networking.domain}";
+ };
+ };
+ })
+ ];
+}