nix-stuff/roles/server/syncthing.nix

61 lines
1.8 KiB
Nix
Executable file

{config, ...}: {
services.syncthing = {
enable = true;
key = config.age.secrets.syncthingKey.path;
cert = config.age.secrets.syncthingCert.path;
guiAddress = "127.0.0.1:8384";
settings.folders = {
"passwords" = {
path = "${config.services.syncthing.dataDir}/passwords";
};
"steam-201810" = {
label = "Wolfenstein The New Order Saves";
id = "laxxf-t2wmy";
devices = ["steamdeck" "server" "pc" "winmax2"];
path = "${config.services.syncthing.dataDir}/steam-201810";
};
"retroarch" = {
label = "RetroArch";
id = "jxuou-2yjnu";
devices = ["steamdeck" "server" "pc" "winmax2"];
path = "${config.services.syncthing.dataDir}/retroarch";
};
"pcsx2" = {
label = "PCSX2";
id = "qcdsp-qaaej";
devices = ["steamdeck" "server" "pc" "winmax2"];
path = "${config.services.syncthing.dataDir}/pcsx2";
};
"school-things" = {
label = "School things";
id = "btsth-vdu9c";
devices = ["server" "pc" "winmax2" "imac"];
path = "${config.services.syncthing.dataDir}/school-things";
};
};
};
systemd.services.syncthing.serviceConfig = {
# Allow syncthing to change ownership of files
AmbientCapabilities = "CAP_CHOWN CAP_FOWNER";
};
# Add a record for syncthing
services.headscale.settings.dns_config.extra_records = [
{
name = "sync.everest.tailscale";
type = "A";
value = "100.100.0.1";
}
];
# Set up caddy as the reverse proxy for syncthing
services.caddy.virtualHosts.syncthing = {
hostName = "sync.everest.tailscale";
extraConfig = ''
import tailscale
reverse_proxy localhost:8384 {
header_up Host {upstream_hostport}
}
'';
};
}