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";
|
2023-12-12 14:32:06 +01:00
|
|
|
dataDir = "/persist/data/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-21 01:37:39 +02:00
|
|
|
configDir = "/persist/state/${config.users.users.pilot.home}/syncthing/.config/syncthing";
|
2023-07-07 21:25:05 +02:00
|
|
|
|
|
|
|
overrideDevices = true;
|
|
|
|
overrideFolders = true;
|
|
|
|
|
2023-09-28 02:13:35 +02:00
|
|
|
settings = {
|
2023-12-12 14:32:06 +01:00
|
|
|
# {{{ Device ids
|
2023-09-28 02:13:35 +02:00
|
|
|
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
|
|
|
|
2024-02-28 07:16:41 +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.
|
|
|
|
systemd.tmpfiles.rules = [ "d ${dataDir} - ${user} ${group} -" ];
|
2023-07-07 21:25:05 +02:00
|
|
|
}
|