feat: added syncthing

This commit is contained in:
Nick 2025-10-09 23:49:09 -05:00
parent 9b1e53fded
commit 74e57b7b63
2 changed files with 52 additions and 26 deletions

View file

@ -46,8 +46,12 @@ in
imports = builtins.attrValues {
inherit (modules)
acme
actual
audiobookshelf
caddy
comfyui
filesorter
firefly-iii
forgejo
glance
jellyfin
@ -57,16 +61,13 @@ in
ollama
opencloud
postgresql
projectSite
prompter
samba
searx
syncthing
vaultwarden
website
projectSite
comfyui
prompter
filesorter
actual
firefly-iii
;
};
};

View file

@ -1,15 +1,42 @@
{ flake, ... }:
{ flake, config, ... }:
let
inherit (flake.config.machines.devices)
synology
phone
mars
ceres
;
inherit (flake.config.services.instances)
syncthing
web
;
hostname = config.networking.hostName;
localhost = web.localhost.address1;
service = syncthing;
localhost = web.localhost.address0;
syncDevices = {
synologySync = {
${synology.name} = {
autoAcceptFolders = true;
name = synology.name;
addresses = [
"tcp://${synology.ip.address0}:${toString service.ports.port2}"
];
id = synology.sync.address0;
};
};
phoneSync = {
${phone.name} = {
autoAcceptFolders = true;
name = phone.name;
addresses = [
"tcp://${phone.ip.address0}:${toString service.ports.port2}"
];
id = phone.sync.address0;
};
};
};
in
{
services = {
@ -21,24 +48,22 @@ in
systemService = true;
guiAddress = "${localhost}:${toString service.ports.port0}";
settings = {
devices = {
${synology.name} = {
autoAcceptFolders = true;
name = synology.name;
addresses = [
"tcp://${synology.ip.address0}:${toString service.ports.port2}"
];
id = synology.sync.address0;
};
${phone.name} = {
autoAcceptFolders = true;
name = phone.name;
addresses = [
"tcp://${phone.ip.address0}:${toString service.ports.port2}"
];
id = phone.sync.address0;
};
};
devices =
if hostname == mars.name then
builtins.attrValues {
inherit (syncDevices)
phoneSync
synologySync
;
}
else if hostname == ceres.name then
builtins.attrValues {
inherit (syncDevices)
synologySync
;
}
else
{ };
};
};
};