1
0
Fork 0

add(syncthing): add module for syncthing with basic configuration

This commit is contained in:
Philipp 2025-07-24 16:10:49 +02:00
parent 6fc0965e15
commit 817858d6ee
Signed by: Philipp
GPG key ID: 9EBD8439AFBAB750
2 changed files with 45 additions and 0 deletions

View file

@ -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";
};
};
}

View file

@ -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;