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