1
Fork 0
satellite/hosts/nixos/common/optional/services/syncthing.nix

39 lines
1.2 KiB
Nix
Raw Normal View History

2024-05-21 01:37:39 +02:00
{ config, ... }:
2023-07-17 16:50:07 +02:00
let
2024-05-21 01:37:39 +02:00
# Using `config.users.users.pilot.name` causes an infinite recursion error
# due to the way the syncthing module is written
user = config.satellite.pilot.name;
2023-07-17 16:50:07 +02:00
group = "syncthing";
2024-05-29 23:04:05 +02:00
dataDir = "/persist/state/var/lib/syncthing";
2023-07-17 16:50:07 +02:00
in
2023-07-07 21:25:05 +02:00
{
services.syncthing = {
2023-12-12 14:32:06 +01:00
inherit user group dataDir;
2023-07-07 21:25:05 +02:00
enable = true;
openDefaultPorts = true;
2024-05-29 23:19:37 +02:00
configDir = "${dataDir}/config";
2023-07-07 21:25:05 +02:00
overrideDevices = true;
overrideFolders = true;
settings = {
2023-12-12 14:32:06 +01:00
# {{{ Device ids
devices = {
enceladus.id = "QWOAERM-V2FNXPI-TB7NFUS-LKW7JTB-IZY4OEZ-FYDPJNP-6IKPW4Y-YREXDQM";
lapetus.id = "VVHM7RC-ZSDOZJI-EGBIJR4-2DOGAXG-OEJZWSH-OYUK5XT-7CDMWSL-3AVM2AZ";
tethys.id = "NGHX5G4-IY3ZXL2-NQMMRQV-2GDQLC6-LIDWSNG-DAJUAQH-KBAP64V-55K2LQ6";
};
2023-12-12 14:32:06 +01:00
# }}}
2023-07-07 21:25:05 +02:00
2023-12-10 12:55:54 +01:00
extraOptions.options.crashReportingEnabled = false;
2023-07-17 16:50:07 +02:00
};
2023-07-07 21:25:05 +02:00
};
2023-12-12 14:32:06 +01:00
# Syncthing seems to leak memory, so we want to restart it daily.
systemd.services.syncthing.serviceConfig.RuntimeMaxSec = "1d";
2023-12-12 14:32:06 +01:00
# I'm not sure this is needed anymore, I just know I got some ownership errors at some point.
2024-05-29 23:19:37 +02:00
systemd.tmpfiles.rules = [ "d ${dataDir} - ${user} ${group}" ];
2023-07-07 21:25:05 +02:00
}