From fb3c68a676643e60e396daf4076684e12d157677 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Fri, 13 Jun 2025 15:02:58 +0530 Subject: Syncthing + service router refactor --- modules/storage/default.nix | 6 ++++++ modules/storage/syncthing.nix | 44 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 modules/storage/default.nix create mode 100644 modules/storage/syncthing.nix (limited to 'modules/storage') diff --git a/modules/storage/default.nix b/modules/storage/default.nix new file mode 100644 index 0000000..22bd2ff --- /dev/null +++ b/modules/storage/default.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + imports = [ + ./syncthing.nix + ]; +} diff --git a/modules/storage/syncthing.nix b/modules/storage/syncthing.nix new file mode 100644 index 0000000..5291182 --- /dev/null +++ b/modules/storage/syncthing.nix @@ -0,0 +1,44 @@ +{ lib, ... }: +let + settings = import ../../settings.nix { inherit lib; }; + group = "syncthing"; +in +{ + systemd.tmpfiles.rules = [ + "d ${settings.syncthing.baseDir} 0770 - ${group} - -" + "d ${settings.syncthing.photosDir} 0770 - ${group} - -" + ]; + users.groups.${group} = { }; + users.users.bacchus.extraGroups = [ group ]; + + networking.firewall.allowedTCPPorts = [ settings.network.ports.syncthing ]; + + services.syncthing = { + enable = true; + user = "bacchus"; + group = group; + dataDir = settings.syncthing.baseDir; + guiAddress = "0.0.0.0:${toString settings.network.ports.syncthing}"; + overrideFolders = true; + + settings = { + folders = { + artemis-photos = { + label = "Photos"; + path = settings.syncthing.photosDir; + }; + }; + + options.urAccepted = -1; + + extraOptions = { + gui = { + enabled = true; + theme = "black"; + user = settings.syncthing.username; + password = settings.syncthing.password; + }; + }; + }; + }; +} -- cgit v1.3.1