syncthing: Enable if needed

This commit is contained in:
Geoffrey Frogeye 2024-06-25 13:26:38 +02:00
parent 91e71bec07
commit 81b1307609
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8

View file

@ -22,10 +22,13 @@ let
folderShouldSyncWith = folder: device: (lib.hasAttrByPath [ folder.name ] device.folders) && device.folders.${folder.name}.syncthing.enable;
folderDeviceEntry = folder: device: { deviceID = device.syncthing.id; };
enable = (builtins.length syncedFolders) > 0;
in
{
config = lib.mkIf cfg.enable {
config = {
services.${service} = {
inherit enable;
openDefaultPorts = true;
configDir = "/var/lib/${service}";
databaseDir = "/var/cache/${service}";