feat: refactored abstractions

This commit is contained in:
Nick 2024-10-19 18:22:29 -05:00
parent f3897c1e0c
commit 2e0ba5f89e
23 changed files with 324 additions and 310 deletions

View file

@ -1,7 +1,8 @@
{flake, ...}: let
inherit (flake.config.system.device) nas phone tablet wildcard;
inherit (flake.config.service.instance.syncthing) ports;
localhost = wildcard.ip.address0;
inherit (flake.config.system.device) nas phone tablet;
inherit (flake.config.service.instance) syncthing web;
service = syncthing;
localhost = web.localhost.address0;
in {
services = {
syncthing = {
@ -10,14 +11,14 @@ in {
overrideFolders = false;
openDefaultPorts = true;
systemService = true;
guiAddress = "${localhost}:${toString ports.port0}";
guiAddress = "${localhost}:${toString service.ports.port0}";
settings = {
devices = {
${nas.name} = {
autoAcceptFolders = true;
name = nas.name;
addresses = [
"tcp://${nas.ip.address0}:${toString ports.port2}"
"tcp://${nas.ip.address0}:${toString service.ports.port2}"
];
id = nas.sync;
};
@ -25,7 +26,7 @@ in {
autoAcceptFolders = true;
name = phone.name;
addresses = [
"tcp://${phone.ip.address0}:${toString ports.port2}"
"tcp://${phone.ip.address0}:${toString service.ports.port2}"
];
id = phone.sync;
};
@ -33,7 +34,7 @@ in {
autoAcceptFolders = true;
name = tablet.name;
addresses = [
"tcp://${tablet.ip.address0}:${toString ports.port2}"
"tcp://${tablet.ip.address0}:${toString service.ports.port2}"
];
id = tablet.sync;
};
@ -45,9 +46,9 @@ in {
networking = {
firewall = {
allowedTCPPorts = [
ports.port0
ports.port1
ports.port2
service.ports.port0
service.ports.port1
service.ports.port2
];
};
};