Commit 8908668a84aa
Changed files (2)
systems
common
services
systems/common/services/syncthing.nix
@@ -0,0 +1,16 @@
+# Open firewall ports for Syncthing (home-manager user service).
+#
+# Syncthing runs as a home-manager service which cannot manage system firewall.
+# This NixOS module opens the required ports:
+# - TCP 22000: Sync protocol (file transfer)
+# - UDP 22000: QUIC sync protocol
+# - UDP 21027: Local discovery (LAN broadcast)
+{
+ networking.firewall = {
+ allowedTCPPorts = [ 22000 ];
+ allowedUDPPorts = [
+ 22000
+ 21027
+ ];
+ };
+}
systems/default.nix
@@ -1,9 +1,11 @@
{
config,
desktop,
+ globals,
hostname,
inputs,
lib,
+ libx,
outputs,
stateVersion,
...
@@ -18,7 +20,11 @@
./common/users
]
++ lib.optional (builtins.pathExists (./. + "/${hostname}/extra.nix")) ./${hostname}/extra.nix
- ++ lib.optional (builtins.isString desktop) ./common/desktop;
+ ++ lib.optional (builtins.isString desktop) ./common/desktop
+ ++ lib.optional (
+ builtins.hasAttr "${hostname}" globals.machines
+ && libx.hasSyncthingFolders globals.machines."${hostname}"
+ ) ./common/services/syncthing.nix;
nixpkgs = {
overlays = [