[microvm] fix errors within module

still checking if list is empty does not work as expected -.-
This commit is contained in:
2024-11-21 13:42:31 +01:00
parent 7b1bce6dc8
commit 1bafdec4ab

View File

@@ -1,9 +1,10 @@
{ config, lib, options, pkgs, ... }: { config, self, lib, inputs, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.malobeo.microvm; cfg = config.services.malobeo.microvm;
hostsEmpty = length cfg.deployHosts == 0;
in in
{ {
options = { options = {
@@ -24,6 +25,11 @@ in
}; };
}; };
imports = [
inputs.microvm.nixosModules.host
];
config = mkIf cfg.enableHostBridge config = mkIf cfg.enableHostBridge
{ {
systemd.network = { systemd.network = {
@@ -57,10 +63,6 @@ in
}; };
}; };
imports = mkIf (lib.length cfg.deployHosts != 0) [
inputs.microvm.nixosModules.host
];
microvm.autostart = cfg.deployHosts; microvm.autostart = cfg.deployHosts;
microvm.vms = microvm.vms =
let let
@@ -68,12 +70,11 @@ in
mapperFunc = name: { inherit name; value = { mapperFunc = name: { inherit name; value = {
# Host build-time reference to where the MicroVM NixOS is defined # Host build-time reference to where the MicroVM NixOS is defined
# under nixosConfigurations # under nixosConfigurations
flake = self; flake = inputs.malobeo;
# Specify from where to let `microvm -u` update later on # Specify from where to let `microvm -u` update later on
updateFlake = "git+https://git.dynamicdiscord.de/kalipso/infrastructure?ref=microvm"; updateFlake = "git+https://git.dynamicdiscord.de/kalipso/infrastructure?ref=microvm";
}; }; }; };
in in
mkIf (lib.length cfg.deployHosts != 0)
builtins.listToAttrs (map mapperFunc cfg.deployHosts); builtins.listToAttrs (map mapperFunc cfg.deployHosts);
}; };
} }