diff --git a/modules/nixos/services/syncthing/default.nix b/modules/nixos/services/syncthing/default.nix new file mode 100644 index 0000000..3e373cb --- /dev/null +++ b/modules/nixos/services/syncthing/default.nix @@ -0,0 +1,44 @@ +{ + lib, + pkgs, + config, + namespace, + ... +}: +with lib; +with lib.${namespace}; +let + cfg = config.${namespace}.services.syncthing; +in +{ + options.${namespace}.services.syncthing = { + enable = mkEnableOption "Syncthing"; + + port = mkOption { + description = "The port to serve Syncthing on."; + type = types.nullOr types.int; + default = 8384; + }; + + ip = mkOption { + description = "The ip to serve Syncthing on."; + type = types.nullOr types.str; + default = "192.168.10.3"; + }; + + openDefaultPorts = mkEnableOption "Whether to open the default ports in the firewall."; + + }; + config = mkIf cfg.enable { + networking.firewall.allowedTCPPorts = [ + cfg.port + ]; + + services.syncthing = { + enable = true; + guiAddress = "${cfg.ip}:${toString cfg.port}"; + openDefaultPorts = mkIf cfg.openDefaultPorts true; + dataDir = "/data/syncthing"; + }; + }; +} diff --git a/systems/x86_64-linux/blarm/default.nix b/systems/x86_64-linux/blarm/default.nix index 9c5e97d..c4ba42b 100644 --- a/systems/x86_64-linux/blarm/default.nix +++ b/systems/x86_64-linux/blarm/default.nix @@ -61,6 +61,7 @@ with lib.${namespace}; searxng = enabled; #immich = enabled; # We wait for the proper version to be in nixpkgs paperless = enabled; + syncthing = enabled; }; #container.invidious = enabled;