working on syncthing

This commit is contained in:
Ingolf Wagner 2024-06-05 18:37:31 +02:00
parent 7a459f998c
commit e96885e3b1
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
3 changed files with 22 additions and 14 deletions

View file

@ -79,7 +79,6 @@ with lib;
locations."/" = { locations."/" = {
root = pkgs.landingpage.override { root = pkgs.landingpage.override {
jsonConfig = [ jsonConfig = [
{ title = "System Links"; } { title = "System Links"; }
{ {

View file

@ -1,25 +1,34 @@
{ config, lib, pkgs, factsGenerator, ... }: { config, lib, pkgs, factsGenerator, ... }:
let
machineDir = "${config.clanCore.clanDir}/machines";
syncthingPub = machine:
lib.removeSuffix "\n"
(builtins.readFile "${machineDir}/${machine}/facts/syncthing.pub");
zerotierIp = machine: (builtins.readFile "${machineDir}/${machine}/facts/zerotier-ip");
in
with lib; { with lib; {
networking.firewall.interfaces."gummybears".allowedTCPPorts = [ 8384 ]; # networking.firewall.interfaces."gummybears".allowedTCPPorts = [ 8384 ];
clanCore.facts.services.syncthing = factsGenerator.syncthing { }; clanCore.facts.services.syncthing = factsGenerator.syncthing { };
services.syncthing = { services.syncthing = {
#guiAddress = lib.mkDefault "${config.networking.hostName}.${config.clan.static-hosts.topLevelDomain}:8384"; #guiAddress = lib.mkDefault "${config.networking.hostName}.${config.clan.static-hosts.topLevelDomain}:8384";
#guiAddress = lib.mkDefault "[${zerotierIp config.networking.hostName}]:8384";
guiAddress = lib.mkDefault "${config.networking.hostName}.private:8384"; guiAddress = lib.mkDefault "${config.networking.hostName}.private:8384";
overrideDevices = lib.mkDefault true; overrideDevices = lib.mkDefault true;
key = config.clanCore.facts.services.syncthing.secret."syncthing.key".path; key = config.clanCore.facts.services.syncthing.secret."syncthing.key".path;
cert = config.clanCore.facts.services.syncthing.secret."syncthing.cert".path; cert = config.clanCore.facts.services.syncthing.secret."syncthing.cert".path;
settings.devices = settings.devices =
let let
machineDir = "${config.clanCore.clanDir}/machines"; #machineDir = "${config.clanCore.clanDir}/machines";
syncthingPub = machine: #syncthingPub = machine:
lib.removeSuffix "\n" # lib.removeSuffix "\n"
(builtins.readFile "${machineDir}/${machine}/facts/syncthing.pub"); # (builtins.readFile "${machineDir}/${machine}/facts/syncthing.pub");
zerotierIp = machine: (builtins.readFile "${machineDir}/${machine}/facts/zerotier-ip"); #zerotierIp = machine: (builtins.readFile "${machineDir}/${machine}/facts/zerotier-ip");
clanDevice = machine: { zeroDevice = machine: {
"${machine}" = { "${machine}" = {
name = machine; name = machine;
id = syncthingPub machine; id = syncthingPub machine;
@ -43,10 +52,10 @@ with lib; {
in in
{ } { }
// (tincDevice "orbi") // (zeroDevice "orbi")
// (tincDevice "cream") // (zeroDevice "cream")
// (tincDevice "cherry") // (zeroDevice "cherry")
// (tincDevice "chungus") // (zeroDevice "chungus")
#// (device "mobi" ) #// (device "mobi" )
#// (device "bobi" ) #// (device "bobi" )

View file

@ -21,7 +21,7 @@
"*.private" = { "*.private" = {
user = "root"; user = "root";
}; };
"*.gummybear" = { "*.bear" = {
user = "root"; user = "root";
}; };
"*.lan" = { "*.lan" = {