]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/system/dilion.nix
Use list for ip4 addresses
[perso/Immae/Config/Nix.git] / modules / private / system / dilion.nix
index 98c5c8b539c2c710afa61bef3ddd896eb649accb..cf00ba67aedd4e2f9989df69caa4c0d8d8e3156c 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 dilion | nix-shell -p ssh-to-age --run ssh-to-age
     hostId = "27c3048d"; # generated with head -c4 /dev/urandom | od -A none -t x4
     firewall.enable = false;
     interfaces."eth0".ipv4.addresses =
-      [ { address = config.hostEnv.ips.main.ip4; prefixLength = 27; } ]
-      ++ pkgs.lib.attrsets.mapAttrsToList
-        (n: ips: { address = ips.ip4; prefixLength = 32; })
-        (pkgs.lib.attrsets.filterAttrs (n: v: n != "main") config.hostEnv.ips);
+      [ { address = lib.head config.hostEnv.ips.main.ip4; prefixLength = 27; } ]
+      ++ 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));
     interfaces."eth0".ipv6.addresses =
       [ { address = "2a01:4f8:141:53e7::"; prefixLength = 64; } ]
       ++ pkgs.lib.flatten (pkgs.lib.attrsets.mapAttrsToList