nix-stuff/roles/server/syncthing.nix

80 lines
2.5 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";
};
"project-diva-mods" = {
label = "Project Diva Mods";
id = "7pscj-6egww";
devices = ["steamdeck" "server" "pc" "winmax2"];
path = "${config.services.syncthing.dataDir}/project-diva-mods";
};
"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"];
path = "${config.services.syncthing.dataDir}/school-things";
};
"project-eden-saves" = {
label = "Project Eden saves";
id = "xa3qx-3ax5k";
devices = ["server" "pc" "winmax2" "steamdeck"];
path = "${config.services.syncthing.dataDir}/project-eden-saves";
};
"games" = {
label = "Games";
id = "mwzph-gf2df";
devices = ["steamdeck" "server" "pc" "winmax2"];
path = "${config.services.syncthing.dataDir}/games";
};
};
};
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.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}
}
'';
};
programs.rust-motd.settings.service_status.Syncthing = "syncthing";
}