nix-stuff/roles/common/services/syncthing.nix
2025-11-06 22:40:29 +01:00

64 lines
1.8 KiB
Nix
Executable file

{
config,
flakeSelf,
...
}: let
hostSecrets = "${flakeSelf.inputs.secrets}/" + config.networking.hostName;
in {
# Get secrets
age.secrets = {
syncthingKey.file = hostSecrets + "/syncthingKey.age";
syncthingCert.file = hostSecrets + "/syncthingCert.age";
};
services.syncthing = {
key = config.age.secrets.syncthingKey.path;
cert = config.age.secrets.syncthingCert.path;
overrideDevices = true;
overrideFolders = true;
openDefaultPorts = true;
settings = {
options = {
urAccepted = 3;
};
# Set up devices and folders common to every device
devices = {
"phone" = {
name = "Xiaomi Redmi Note 10 Pro";
id = "K7KNZ5V-XREUADL-CROQXPV-6AA4H65-2VUD34Z-VQWKJ6S-LWWW4EE-XPNEZQ6";
};
"pc" = {
name = "Archie";
id = "NJPX754-64AQNP3-7GZFIRZ-W2EDRJQ-27ORWYM-X5YXEXQ-ERRTRTQ-BSYD4AY";
};
"steamdeck" = {
name = "Steam Deck";
id = "DNFEGEA-PDEVW5A-O5VBVQK-IUXI7J5-MAHCQAG-2JLEFFM-DSXB6AS-TX6ZHAN";
};
"server" = {
name = "Everest";
id = "2GXFZJZ-CF56ER2-SISBGOF-VNXJIG5-GQC6ECA-NHCHAPX-677RSJT-RI5POAZ";
};
"surface" = {
name = "Surface Go";
id = "HTVSF3O-AHY3TNH-BLVSEGK-HRRSMHC-H5LJWVF-NDKGM6O-ATWZALC-YXNV2Q4";
};
"winmax2" = {
name = "Win Max 2";
id = "X2NILRM-ADRBQ23-AFREAZA-62GVFDF-UVMPR4L-KGHMUNY-BJ2C3CQ-RBT43QS";
};
};
folders = {
"passwords" = {
label = "KeePassXC Passwords";
id = "rdyaq-ex659";
devices = ["phone" "pc" "steamdeck" "server" "surface" "winmax2"];
};
};
};
};
networking.firewall = {
allowedTCPPorts = [22000];
allowedUDPPorts = [22000 21027];
};
}