Commit 54faeab1083a

Vincent Demeester <vincent@sbr.pm>
2026-06-15 11:30:29
feat(aomi): manage /etc/hosts via system-manager
Generated VPN and home network host entries from globals.nix so .vpn domains resolve without relying on DNS (which breaks under Red Hat VPN).
1 parent bff2b15
Changed files (1)
systems
systems/aomi/system.nix
@@ -1,11 +1,17 @@
 {
+  lib,
   pkgs,
   globals,
+  libx,
   ...
 }:
 let
   machine = globals.machines.aomi;
   vpnServer = globals.machines.carthage;
+  hostsEntries = libx.hostConfigs globals.machines;
+  hostsFile = lib.concatStringsSep "\n" (
+    lib.mapAttrsToList (ip: names: "${ip} ${lib.concatStringsSep " " names}") hostsEntries
+  );
 in
 {
   config = {
@@ -59,6 +65,17 @@ in
       mode = "0644";
     };
 
+    # /etc/hosts entries for VPN and home network hosts
+    environment.etc.hosts = {
+      text = ''
+        127.0.0.1 localhost
+        ::1 localhost
+        ${hostsFile}
+      '';
+      mode = "0644";
+      replaceExisting = true;
+    };
+
     # Syncthing is managed by home-manager (user service with full folder config)
   };
 }