From e96885e3b1fb92217336d19a3b8dd862021563a0 Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Wed, 5 Jun 2024 18:37:31 +0200 Subject: [PATCH] working on syncthing --- nixos/components/network/nginx.nix | 1 - nixos/components/network/syncthing.nix | 33 ++++++++++++++++---------- nixos/homes/palo/ssh.nix | 2 +- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/nixos/components/network/nginx.nix b/nixos/components/network/nginx.nix index 6dfcf20..3fb5686 100644 --- a/nixos/components/network/nginx.nix +++ b/nixos/components/network/nginx.nix @@ -79,7 +79,6 @@ with lib; locations."/" = { root = pkgs.landingpage.override { - jsonConfig = [ { title = "System Links"; } { diff --git a/nixos/components/network/syncthing.nix b/nixos/components/network/syncthing.nix index 08d49ea..3d83131 100644 --- a/nixos/components/network/syncthing.nix +++ b/nixos/components/network/syncthing.nix @@ -1,25 +1,34 @@ { 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; { - networking.firewall.interfaces."gummybears".allowedTCPPorts = [ 8384 ]; + # networking.firewall.interfaces."gummybears".allowedTCPPorts = [ 8384 ]; clanCore.facts.services.syncthing = factsGenerator.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"; overrideDevices = lib.mkDefault true; key = config.clanCore.facts.services.syncthing.secret."syncthing.key".path; cert = config.clanCore.facts.services.syncthing.secret."syncthing.cert".path; settings.devices = 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"); + #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"); - clanDevice = machine: { + zeroDevice = machine: { "${machine}" = { name = machine; id = syncthingPub machine; @@ -43,10 +52,10 @@ with lib; { in { } - // (tincDevice "orbi") - // (tincDevice "cream") - // (tincDevice "cherry") - // (tincDevice "chungus") + // (zeroDevice "orbi") + // (zeroDevice "cream") + // (zeroDevice "cherry") + // (zeroDevice "chungus") #// (device "mobi" ) #// (device "bobi" ) diff --git a/nixos/homes/palo/ssh.nix b/nixos/homes/palo/ssh.nix index 16e9055..1294ccb 100644 --- a/nixos/homes/palo/ssh.nix +++ b/nixos/homes/palo/ssh.nix @@ -21,7 +21,7 @@ "*.private" = { user = "root"; }; - "*.gummybear" = { + "*.bear" = { user = "root"; }; "*.lan" = {