[microvm] Fix conditionals within module

finally i hope....
This commit is contained in:
2024-11-21 15:25:57 +01:00
parent bdd13a204f
commit 84fef37dc7

View File

@@ -29,8 +29,8 @@ in
inputs.microvm.nixosModules.host inputs.microvm.nixosModules.host
]; ];
config = { config = mkIf cfg.enableHostBridge {
systemd.network = mkIf cfg.enableHostBridge { systemd.network = {
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 = {
@@ -54,16 +54,13 @@ in
} ]; } ];
}; };
} // mkIf (!hostEmpty) {
# connect the vms to the bridge # connect the vms to the bridge
networks."11-microvm" = { networks."11-microvm" = {
matchConfig.Name = "vm-*"; matchConfig.Name = "vm-*";
networkConfig.Bridge = "microvm"; networkConfig.Bridge = "microvm";
}; };
}; };
microvm.autostart = cfg.deployHosts;
microvm.vms = microvm.vms =
let let
# Map the values to each hostname to then generate a Attrs using listToAttrs # Map the values to each hostname to then generate a Attrs using listToAttrs