forked from malobeo/infrastructure
[run-vm] add testHost option to module to allow local testing again
This commit is contained in:
@@ -14,6 +14,12 @@ in
|
||||
description = lib.mdDoc "Setup bridge device for microvms.";
|
||||
};
|
||||
|
||||
testHost = mkOption {
|
||||
default = false;
|
||||
type = types.bool;
|
||||
description = lib.mdDoc "Enable when the host is used for development and testing using run-vm";
|
||||
};
|
||||
|
||||
interface = mkOption {
|
||||
default = "eno1";
|
||||
type = types.str;
|
||||
@@ -68,7 +74,7 @@ in
|
||||
systemd.network = mkIf (cfg.enableHostBridge || cfg.enableHostBridgeUnstable) {
|
||||
enable = true;
|
||||
networks."10-lan" = {
|
||||
matchConfig.Name = [ "${cfg.interface}" "vm-*"];
|
||||
matchConfig.Name = ["vm-*"] ++ (if !cfg.testHost then [ "${cfg.interface}" ] else [ ]);
|
||||
networkConfig = {
|
||||
Bridge = "malobeo0";
|
||||
};
|
||||
@@ -81,7 +87,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
networks."10-lan-bridge" = {
|
||||
networks."10-lan-bridge" = if !cfg.testHost then {
|
||||
matchConfig.Name = "malobeo0";
|
||||
networkConfig = {
|
||||
Address = [ "${cfg.address}" ];
|
||||
@@ -90,6 +96,17 @@ in
|
||||
IPv6AcceptRA = true;
|
||||
};
|
||||
linkConfig.RequiredForOnline = "routable";
|
||||
} else {
|
||||
matchConfig.Name = "malobeo0";
|
||||
networkConfig = {
|
||||
DHCPServer = true;
|
||||
IPv6SendRA = true;
|
||||
};
|
||||
addresses = if cfg.enableHostBridgeUnstable then [
|
||||
{ Address = "10.0.0.1/24"; }
|
||||
] else [
|
||||
{ Address = "10.0.0.1/24"; }
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user