[microvm] differentiate between stable and unstable nixpkgs
Some checks failed
Evaluate Hydra Jobs / eval-hydra-jobs (push) Has been cancelled
Evaluate Hydra Jobs / eval-hydra-jobs (pull_request) Failing after 14m32s

This commit is contained in:
2024-11-21 15:50:13 +01:00
parent 28bf68098c
commit d212728676

View File

@@ -14,6 +14,12 @@ in
description = lib.mdDoc "Setup bridge device for microvms."; description = lib.mdDoc "Setup bridge device for microvms.";
}; };
enableHostBridgeUnstable = mkOption {
default = false;
type = types.bool;
description = lib.mdDoc "Setup bridge device for microvms.";
};
deployHosts = mkOption { deployHosts = mkOption {
default = []; default = [];
type = types.listOf types.str; type = types.listOf types.str;
@@ -29,8 +35,17 @@ in
inputs.microvm.nixosModules.host inputs.microvm.nixosModules.host
]; ];
config = mkIf cfg.enableHostBridge { config = {
systemd.network = { assertions = [
{
assertion = !(cfg.enableHostBridgeUnstable && cfg.enableHostBridge);
message = ''
Only enableHostBridge or enableHostBridgeUnstable! Not Both!
'';
}
];
systemd.network = mkIf (cfg.enableHostBridge || cfg.enableHostBridgeUnstable) {
enable = true; enable = true;
# create a bride device that all the microvms will be connected to # create a bride device that all the microvms will be connected to
netdevs."10-microvm".netdevConfig = { netdevs."10-microvm".netdevConfig = {
@@ -44,14 +59,11 @@ in
DHCPServer = true; DHCPServer = true;
IPv6SendRA = true; IPv6SendRA = true;
}; };
addresses = [ { addresses = if cfg.enableHostBridgeUnstable then [
Address = "10.0.0.1/24"; { Address = "10.0.0.1/24"; }
} { ] else [
Address = "fd12:3456:789a::1/64"; { addressConfig.Address = "10.0.0.1/24"; }
} ]; ];
ipv6Prefixes = [ {
Prefix = "fd12:3456:789a::/64";
} ];
}; };
# connect the vms to the bridge # connect the vms to the bridge