added syncthing configDir to persistence

This commit is contained in:
Leyla Becker 2025-03-02 15:25:48 -06:00
parent eb13447136
commit 2a81195563

View file

@ -4,6 +4,7 @@
... ...
}: let }: let
mountDir = "/mnt/sync"; mountDir = "/mnt/sync";
configDir = "/etc/syncthing";
in { in {
options.host.sync = { options.host.sync = {
enable = lib.mkEnableOption "should sync thing be enabled on this device"; enable = lib.mkEnableOption "should sync thing be enabled on this device";
@ -72,7 +73,7 @@ in {
user = "syncthing"; user = "syncthing";
group = "syncthing"; group = "syncthing";
dataDir = "${mountDir}/default"; dataDir = "${mountDir}/default";
configDir = "/etc/syncthing"; configDir = configDir;
overrideDevices = true; overrideDevices = true;
overrideFolders = true; overrideFolders = true;
settings = { settings = {
@ -165,6 +166,12 @@ in {
} }
(lib.mkIf config.host.impermanence.enable { (lib.mkIf config.host.impermanence.enable {
assertions = [
{
assertion = config.services.syncthing.configDir == configDir;
message = "syncthing config dir does not match persistence";
}
];
environment.persistence = { environment.persistence = {
"/persist/system/root" = { "/persist/system/root" = {
enable = true; enable = true;
@ -175,6 +182,11 @@ in {
user = "syncthing"; user = "syncthing";
group = "syncthing"; group = "syncthing";
} }
{
directory = configDir;
user = "syncthing";
group = "syncthing";
}
]; ];
}; };
}; };