[host_builder] fix: static network cfg was only used in microvms

This commit is contained in:
2026-08-31 16:57:03 +02:00
parent 9cb1b107c3
commit 0a03babba8
2 changed files with 26 additions and 14 deletions
+10
View File
@@ -29,6 +29,8 @@ in
local = true;
hostId = "11";
address = "192.168.1.101";
gateway = "192.168.1.1";
nameservers = [ "192.168.1.1" "1.1.1.1" ];
};
};
@@ -38,6 +40,8 @@ in
local = true;
hostId = "12";
address = "192.168.1.102";
gateway = "192.168.1.1";
nameservers = [ "192.168.1.1" "1.1.1.1" ];
};
};
@@ -47,6 +51,8 @@ in
local = true;
hostId = "13";
address = "192.168.1.103";
gateway = "192.168.1.1";
nameservers = [ "192.168.1.1" "1.1.1.1" ];
};
};
@@ -56,6 +62,8 @@ in
local = true;
hostId = "15";
address = "192.168.1.105";
gateway = "192.168.1.1";
nameservers = [ "192.168.1.1" "1.1.1.1" ];
};
};
@@ -65,6 +73,8 @@ in
local = true;
hostId = "19";
address = "192.168.1.111";
gateway = "192.168.1.1";
nameservers = [ "192.168.1.1" "1.1.1.1" ];
};
};
+16 -14
View File
@@ -45,6 +45,20 @@ rec {
];
defaultModules = baseModules;
makeNetwork = network: [{
systemd.network.enable = true;
systemd.network.networks."20-lan" = {
matchConfig.Type = "ether";
networkConfig = {
Address = [ "${network.address}/24" ];
Gateway = "${network.gateway}";
DNS = network.nameservers;
DHCP = "no";
};
};
}];
makeMicroVM = hostName: network: modules: [
{
microvm = {
@@ -89,18 +103,6 @@ rec {
}
];
};
systemd.network.enable = true;
systemd.network.networks."20-lan" = {
matchConfig.Type = "ether";
networkConfig = {
Address = [ "${network.address}/24" ];
Gateway = "${network.gateway}";
DNS = network.nameservers;
DHCP = "no";
};
};
}
] ++ defaultModules ++ modules;
@@ -259,9 +261,9 @@ rec {
specialArgs.inputs = inputsMod;
specialArgs.self = self;
modules = (if (settings.type != "microvm") then
defaultModules ++ [ ../${host}/configuration.nix ]
(makeNetwork settings.network) ++ defaultModules ++ [ ../${host}/configuration.nix ]
else
makeMicroVM "${host}" settings.network [
(makeNetwork settings.network) ++ makeMicroVM "${host}" settings.network [
inputs.microvm.nixosModules.microvm
../${host}/configuration.nix
]);