This commit is contained in:
Lennart J. Kurzweg (Nx2)
2024-06-03 19:53:43 +02:00
parent fce5f49e57
commit aff6992949
4 changed files with 44 additions and 33 deletions

View File

@@ -1,4 +1,4 @@
{ config, pkgs, lib, user, host, secrets, ...}:
{ config, lib, user, host, secrets, ...}:
let
# helper funcitons
conv = _: device: with device; { "${name}" = {id = id;};};
@@ -25,14 +25,8 @@ lib.mkIf (user != "tv")
{
sops.secrets = {
"syncthing/${host}-cert.pem" = {
owner = user;
# path = "/home/${user}/.config/syncthing/cert.pem";
};
"syncthing/${host}-key.pem" = {
owner = user;
# path = "/home/${user}/.config/syncthing/key.pem";
};
"syncthing/${host}/cert.pem" = { owner = user; };
"syncthing/${host}/key.pem" = { owner = user; };
};
services.syncthing = with (builtins.mapAttrs conv devices); {
@@ -40,10 +34,8 @@ lib.mkIf (user != "tv")
user = "${user}";
dataDir = "/home/${user}/.local/share/syncthing"; # useless ?
configDir = cd;
# key = "/home/${user}/.config/syncthing/key.pem";
# cert = "/home/${user}/.config/syncthing/cert.pem";
key = config.sops.secrets."syncthing/${host}-key.pem".path;
cert = config.sops.secrets."syncthing/${host}-cert.pem".path;
key = config.sops.secrets."syncthing/${host}/key.pem".path;
cert = config.sops.secrets."syncthing/${host}/cert.pem".path;
overrideDevices = true;
overrideFolders = true;
guiAddress = if ( host == "NxACE" ) then "0.0.0.0:8384" else "127.0.0.1:8384";
@@ -58,12 +50,13 @@ lib.mkIf (user != "tv")
folders = with dirs; if (host == "NxXPS") then {
"${default.name}" = {
path = default.path;
devices = with devices; (justname [ north ace s21u ]);
devices = with devices; (justname [ north s21u ]);
# devices = with devices; (justname [ north ace s21u ]);
};
} else if (host == "NxNORTH") then {
"${default.name}" = {
path = default.path;
devices = with devices; (justname [ s21u ]);
devices = with devices; (justname [ s21u xps ]);
# devices = with devices; (justname [ xps ace s21u ]);
};
} else {