[run-vm] add testHost option to module to allow local testing again
All checks were successful
Check flake syntax / flake-check (push) Successful in 5m40s
All checks were successful
Check flake syntax / flake-check (push) Successful in 5m40s
This commit is contained in:
@@ -14,6 +14,12 @@ in
|
|||||||
description = lib.mdDoc "Setup bridge device for microvms.";
|
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 {
|
interface = mkOption {
|
||||||
default = "eno1";
|
default = "eno1";
|
||||||
type = types.str;
|
type = types.str;
|
||||||
@@ -68,7 +74,7 @@ in
|
|||||||
systemd.network = mkIf (cfg.enableHostBridge || cfg.enableHostBridgeUnstable) {
|
systemd.network = mkIf (cfg.enableHostBridge || cfg.enableHostBridgeUnstable) {
|
||||||
enable = true;
|
enable = true;
|
||||||
networks."10-lan" = {
|
networks."10-lan" = {
|
||||||
matchConfig.Name = [ "${cfg.interface}" "vm-*"];
|
matchConfig.Name = ["vm-*"] ++ (if !cfg.testHost then [ "${cfg.interface}" ] else [ ]);
|
||||||
networkConfig = {
|
networkConfig = {
|
||||||
Bridge = "malobeo0";
|
Bridge = "malobeo0";
|
||||||
};
|
};
|
||||||
@@ -81,7 +87,7 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
networks."10-lan-bridge" = {
|
networks."10-lan-bridge" = if !cfg.testHost then {
|
||||||
matchConfig.Name = "malobeo0";
|
matchConfig.Name = "malobeo0";
|
||||||
networkConfig = {
|
networkConfig = {
|
||||||
Address = [ "${cfg.address}" ];
|
Address = [ "${cfg.address}" ];
|
||||||
@@ -90,6 +96,17 @@ in
|
|||||||
IPv6AcceptRA = true;
|
IPv6AcceptRA = true;
|
||||||
};
|
};
|
||||||
linkConfig.RequiredForOnline = "routable";
|
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