mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-07-15 17:13:21 +02:00
feat: dae - arm64 microvm
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
{myvars, ...}: let
|
||||
hostName = "suzu";
|
||||
inherit (myvars.networking) defaultGateway nameservers;
|
||||
inherit (myvars.networking.hostsAddr.${hostName}) iface ipv4;
|
||||
|
||||
ipv4WithMask = "${ipv4}/24";
|
||||
in {
|
||||
boot = {
|
||||
kernel = {
|
||||
sysctl = {
|
||||
# forward network packets that are not destined for the interface on which they were received
|
||||
"net.ipv4.conf.all.forwarding" = true;
|
||||
"net.ipv6.conf.all.forwarding" = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
networking.useNetworkd = true;
|
||||
systemd.network.enable = true;
|
||||
|
||||
# A bridge to link all VM's TAP interfaces into local network.
|
||||
# https://github.com/astro/microvm.nix/blob/main/doc/src/simple-network.md
|
||||
systemd.network.networks."10-lan" = {
|
||||
# match on the main interface and all VM interfaces
|
||||
matchConfig.Name = [iface "vm-*"];
|
||||
networkConfig = {
|
||||
Bridge = "br0";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.network.netdevs."br0" = {
|
||||
netdevConfig = {
|
||||
Name = "br0";
|
||||
Kind = "bridge";
|
||||
};
|
||||
};
|
||||
|
||||
# Add ipv4 address to the bridge.
|
||||
systemd.network.networks."10-lan-bridge" = {
|
||||
matchConfig.Name = "br0";
|
||||
networkConfig = {
|
||||
Address = [ipv4WithMask];
|
||||
Gateway = defaultGateway;
|
||||
DNS = nameservers;
|
||||
IPv6AcceptRA = true;
|
||||
};
|
||||
linkConfig.RequiredForOnline = "routable";
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user