{ config, lib, ... }: let attrSets = lib.lists.imap1 (i: v: { name = v; index = i; }) (builtins.attrNames config.microvm.vms); in { config.microvm.hyprvisor = "cloud-hyprvisor"; systemd.network.networks = builtins.listToAttrs attrSet ({ name, index, }: { name = "30-vm${name}"; value = { matchConfig.Name = "vm${name}"; address = [ "10.0.0.0/32" ]; routes = [ { Destination = "10.0.0.${toString index}/32"; } ]; networkConfig = {IPv4Forwarding = true;}; }; }); # NAT (make vms accessible in host) networking.nat = { enable = true; internalIps = ["10.0.0.0/24"]; externalInterface = "enp2s0"; }; }