Commit ef59c762b7c6

Vincent Demeester <vincent@sbr.pm>
2025-10-16 15:53:34
systems/nagoya: also server nagoya.home properly
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 7385998
Changed files (2)
lib
systems
lib/functions.nix
@@ -25,6 +25,14 @@ let
   */
   hasVPNips = host: (builtins.length (lib.attrsets.attrByPath [ "net" "vpn" "ips" ] [ ] host)) > 0;
 
+  /**
+    Check if a host has network IP addresses configured.
+
+    @param host The host configuration to check
+    @return true if host has at least one VPN IP address, false otherwise
+  */
+  hasIps = host: (builtins.length (lib.attrsets.attrByPath [ "net" "ips" ] [ ] host)) > 0;
+
   /**
     Return true if the given host has a list of Syncthing folder configured.
 
systems/nagoya/extra.nix
@@ -58,10 +58,10 @@
       locations = lib.attrsets.mapAttrs' (
         name: value:
         lib.attrsets.nameValuePair "/syncthing/${name}/" {
-          proxyPass = "http://${builtins.head value.net.vpn.ips}:8384/";
+          proxyPass = "http://${builtins.head value.net.ips}:8384/";
           recommendedProxySettings = true;
         }
-      ) (lib.attrsets.filterAttrs (_name: value: (libx.hasVPNips value)) globals.machines);
+      ) (lib.attrsets.filterAttrs (_name: value: (libx.hasIps value)) globals.machines);
     };
   };