From 60c44fde5a710e5aab80020a1ddf0f443b926505 Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Wed, 5 Jun 2024 16:55:55 +0200 Subject: [PATCH] fixing syncthing (using tinc again) --- nixos/components/network/syncthing.nix | 47 +++++++++++--------------- nixos/machines/cherry/syncthing.nix | 1 + nixos/machines/cream/syncthing.nix | 1 + 3 files changed, 22 insertions(+), 27 deletions(-) diff --git a/nixos/components/network/syncthing.nix b/nixos/components/network/syncthing.nix index ff5f3c5..da8a625 100644 --- a/nixos/components/network/syncthing.nix +++ b/nixos/components/network/syncthing.nix @@ -23,16 +23,14 @@ with lib; { }; 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; key = "/run/facts/syncthing.key"; cert = "/run/facts/syncthing.cert"; settings.devices = let machineDir = "${config.clanCore.clanDir}/machines"; - #machinesFileSet = builtins.readDir machineDir; - #machines = lib.mapAttrsToList (name: _: name) machinesFileSet; syncthingPub = machine: lib.removeSuffix "\n" (builtins.readFile "${machineDir}/${machine}/facts/syncthing.pub"); @@ -45,40 +43,35 @@ with lib; { addresses = [ "tcp://[${zerotierIp machine}]:22000" ]; }; }; - - device = name: id: { - "${name}" = { - name = name; + tincDevice = machine: { + "${machine}" = { + name = machine; + id = syncthingPub machine; + addresses = [ "tcp://${machine}.private:22000" ]; + }; + }; + device = machine: id: { + "${machine}" = { + name = machine; id = id; - addresses = [ "tcp://${name}.private:22000" ]; + #addresses = [ "tcp://${machine}.private:22000" ]; }; }; in { } - #{ - # "orbi" = { - # name = "orbi"; - # id = "5U5ZP6R-SUQO5SY-WICWWLZ-HPHQBM5-P27YSU6-66TWIBK-XLX4X5N-4O6TVAC"; - # addresses = [ "tcp://95.216.66.212:22000" ]; - # }; - #} + + // (tincDevice "orbi") + // (tincDevice "cream") + // (tincDevice "cherry") + // (tincDevice "chungus") #// (device "mobi" ) #// (device "bobi" ) - // (clanDevice "orbi") - // (clanDevice "cream") - // (clanDevice "cherry") - // (clanDevice "chungus") - // (device "iPhone" "APFS6SA-VVTARXU-3WHHRZG-TE5N3T4-X4IC76V-T67EKZ6-NLGP3TW-EZYXYAH") // (device "iPad" "JDDNVYD-H3WMSSS-WZ745KL-7QEGN6O-ZSGQLQU-YBR2L42-7FO7KJ4-BXPYDA5") - // { - bumba = { - name = "windows-bumba"; - id = "JS7PWTO-VKFGBUP-GNFLSWP-MGFJ2KH-HLO2LKW-V3RPCR6-PCB5SQC-42FCKQZ"; - }; - }; + // (device "bumba" "JS7PWTO-VKFGBUP-GNFLSWP-MGFJ2KH-HLO2LKW-V3RPCR6-PCB5SQC-42FCKQZ") + ; settings.folders = { diff --git a/nixos/machines/cherry/syncthing.nix b/nixos/machines/cherry/syncthing.nix index c18bf6e..f8eb2e8 100644 --- a/nixos/machines/cherry/syncthing.nix +++ b/nixos/machines/cherry/syncthing.nix @@ -5,6 +5,7 @@ enable = true; openDefaultPorts = false; user = "palo"; + group = "users"; dataDir = "/home/palo/.syncthing"; configDir = "/home/palo/.syncthing"; overrideFolders = true; diff --git a/nixos/machines/cream/syncthing.nix b/nixos/machines/cream/syncthing.nix index 722fd26..023fad6 100644 --- a/nixos/machines/cream/syncthing.nix +++ b/nixos/machines/cream/syncthing.nix @@ -5,6 +5,7 @@ enable = true; openDefaultPorts = false; user = "palo"; + group = "users"; dataDir = "/home/palo/.syncthing"; configDir = "/home/palo/.syncthing"; overrideFolders = true;