fixing syncthing (using tinc again)

This commit is contained in:
Ingolf Wagner 2024-06-05 16:55:55 +02:00
parent 5c63d0ce64
commit 60c44fde5a
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
3 changed files with 22 additions and 27 deletions

View file

@ -23,16 +23,14 @@ with lib; {
}; };
services.syncthing = { services.syncthing = {
enable = lib.mkForce false; # fixme: make sure zerotier works befor enabling this again. #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 "${config.networking.hostName}.private:8384";
overrideDevices = lib.mkDefault true; overrideDevices = lib.mkDefault true;
key = "/run/facts/syncthing.key"; key = "/run/facts/syncthing.key";
cert = "/run/facts/syncthing.cert"; cert = "/run/facts/syncthing.cert";
settings.devices = settings.devices =
let let
machineDir = "${config.clanCore.clanDir}/machines"; machineDir = "${config.clanCore.clanDir}/machines";
#machinesFileSet = builtins.readDir machineDir;
#machines = lib.mapAttrsToList (name: _: name) machinesFileSet;
syncthingPub = machine: syncthingPub = machine:
lib.removeSuffix "\n" lib.removeSuffix "\n"
(builtins.readFile "${machineDir}/${machine}/facts/syncthing.pub"); (builtins.readFile "${machineDir}/${machine}/facts/syncthing.pub");
@ -45,40 +43,35 @@ with lib; {
addresses = [ "tcp://[${zerotierIp machine}]:22000" ]; addresses = [ "tcp://[${zerotierIp machine}]:22000" ];
}; };
}; };
tincDevice = machine: {
device = name: id: { "${machine}" = {
"${name}" = { name = machine;
name = name; id = syncthingPub machine;
addresses = [ "tcp://${machine}.private:22000" ];
};
};
device = machine: id: {
"${machine}" = {
name = machine;
id = id; id = id;
addresses = [ "tcp://${name}.private:22000" ]; #addresses = [ "tcp://${machine}.private:22000" ];
}; };
}; };
in in
{ } { }
#{
# "orbi" = { // (tincDevice "orbi")
# name = "orbi"; // (tincDevice "cream")
# id = "5U5ZP6R-SUQO5SY-WICWWLZ-HPHQBM5-P27YSU6-66TWIBK-XLX4X5N-4O6TVAC"; // (tincDevice "cherry")
# addresses = [ "tcp://95.216.66.212:22000" ]; // (tincDevice "chungus")
# };
#}
#// (device "mobi" ) #// (device "mobi" )
#// (device "bobi" ) #// (device "bobi" )
// (clanDevice "orbi")
// (clanDevice "cream")
// (clanDevice "cherry")
// (clanDevice "chungus")
// (device "iPhone" "APFS6SA-VVTARXU-3WHHRZG-TE5N3T4-X4IC76V-T67EKZ6-NLGP3TW-EZYXYAH") // (device "iPhone" "APFS6SA-VVTARXU-3WHHRZG-TE5N3T4-X4IC76V-T67EKZ6-NLGP3TW-EZYXYAH")
// (device "iPad" "JDDNVYD-H3WMSSS-WZ745KL-7QEGN6O-ZSGQLQU-YBR2L42-7FO7KJ4-BXPYDA5") // (device "iPad" "JDDNVYD-H3WMSSS-WZ745KL-7QEGN6O-ZSGQLQU-YBR2L42-7FO7KJ4-BXPYDA5")
// { // (device "bumba" "JS7PWTO-VKFGBUP-GNFLSWP-MGFJ2KH-HLO2LKW-V3RPCR6-PCB5SQC-42FCKQZ")
bumba = { ;
name = "windows-bumba";
id = "JS7PWTO-VKFGBUP-GNFLSWP-MGFJ2KH-HLO2LKW-V3RPCR6-PCB5SQC-42FCKQZ";
};
};
settings.folders = { settings.folders = {

View file

@ -5,6 +5,7 @@
enable = true; enable = true;
openDefaultPorts = false; openDefaultPorts = false;
user = "palo"; user = "palo";
group = "users";
dataDir = "/home/palo/.syncthing"; dataDir = "/home/palo/.syncthing";
configDir = "/home/palo/.syncthing"; configDir = "/home/palo/.syncthing";
overrideFolders = true; overrideFolders = true;

View file

@ -5,6 +5,7 @@
enable = true; enable = true;
openDefaultPorts = false; openDefaultPorts = false;
user = "palo"; user = "palo";
group = "users";
dataDir = "/home/palo/.syncthing"; dataDir = "/home/palo/.syncthing";
configDir = "/home/palo/.syncthing"; configDir = "/home/palo/.syncthing";
overrideFolders = true; overrideFolders = true;