]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/system/eldiron.nix
Use list for ip4 addresses
[perso/Immae/Config/Nix.git] / modules / private / system / eldiron.nix
index 8b2784d0d315ce87d0b1fbfe546f6689854e55ce..32f0e19fd26ee5d4b53385511919bf259ab2696f 100644 (file)
@@ -2,7 +2,7 @@
 {
   deployment = {
     targetUser = "root";
-    targetHost = config.hostEnv.ips.main.ip4;
+    targetHost = lib.head config.hostEnv.ips.main.ip4;
     substituteOnDestination = true;
   };
   # ssh-keyscan eldiron | nix-shell -p ssh-to-age --run ssh-to-age
     hostId = "8262ca33"; # generated with head -c4 /dev/urandom | od -A none -t x4
     firewall.enable = true;
     # FIXME: on next reboot, remove the /27 and the localCommands
-    interfaces."eth0".ipv4.addresses =
-      pkgs.lib.attrsets.mapAttrsToList
-        (n: ips: { address = ips.ip4; prefixLength = 32; })
-        (pkgs.lib.attrsets.filterAttrs (n: v: n != "main") config.hostEnv.ips)
-      ++ [ { address = config.hostEnv.ips.main.ip4; prefixLength = 27; } ];
+    interfaces."eth0".ipv4.addresses = pkgs.lib.flatten (pkgs.lib.attrsets.mapAttrsToList
+      (n: ips: map (ip: { address = ip; prefixLength = 32; }) (ips.ip4 or []))
+      (pkgs.lib.attrsets.filterAttrs (n: v: n != "main") config.hostEnv.ips))
+      ++ [ { address = lib.head config.hostEnv.ips.main.ip4; prefixLength = 27; } ];
     interfaces."eth0".ipv6.addresses = pkgs.lib.flatten (pkgs.lib.attrsets.mapAttrsToList
       (n: ips: map (ip: { address = ip; prefixLength = (if n == "main" && ip == pkgs.lib.head ips.ip6 then 64 else 128); }) (ips.ip6 or []))
       config.hostEnv.ips);