Files
nixos/modules/services/syncthing.nix
2025-02-15 11:16:40 +02:00

32 lines
665 B
Nix

{ config, lib, ... }:
let
cfg = config.services.syncthing;
fqdn = "${cfg.subdomain}.${config.networking.domain}";
in
{
options.services.syncthing = {
subdomain = lib.mkOption {
type = lib.types.str;
};
port = lib.mkOption {
type = lib.types.int;
default = 8384;
};
};
config = lib.mkIf cfg.enable {
services = {
syncthing = {
openDefaultPorts = true;
guiAddress = "[::1]:${toString cfg.port}";
settings.gui.insecureSkipHostCheck = true;
};
webserver = {
enable = lib.mkDefault true;
vHosts.${fqdn}.locations."/".proxyPort = cfg.port;
};
};
};
}