From 1bafdec4aba4e78a732226c8a25a3a0b32a46dfc Mon Sep 17 00:00:00 2001 From: kalipso Date: Thu, 21 Nov 2024 13:42:31 +0100 Subject: [PATCH] [microvm] fix errors within module still checking if list is empty does not work as expected -.- --- machines/modules/malobeo/microvm_host.nix | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/machines/modules/malobeo/microvm_host.nix b/machines/modules/malobeo/microvm_host.nix index fc1c8162..d7cdc55b 100644 --- a/machines/modules/malobeo/microvm_host.nix +++ b/machines/modules/malobeo/microvm_host.nix @@ -1,9 +1,10 @@ -{ config, lib, options, pkgs, ... }: +{ config, self, lib, inputs, options, pkgs, ... }: with lib; let cfg = config.services.malobeo.microvm; + hostsEmpty = length cfg.deployHosts == 0; in { options = { @@ -24,6 +25,11 @@ in }; }; + + imports = [ + inputs.microvm.nixosModules.host + ]; + config = mkIf cfg.enableHostBridge { systemd.network = { @@ -57,10 +63,6 @@ in }; }; - imports = mkIf (lib.length cfg.deployHosts != 0) [ - inputs.microvm.nixosModules.host - ]; - microvm.autostart = cfg.deployHosts; microvm.vms = let @@ -68,12 +70,11 @@ in mapperFunc = name: { inherit name; value = { # Host build-time reference to where the MicroVM NixOS is defined # under nixosConfigurations - flake = self; + flake = inputs.malobeo; # Specify from where to let `microvm -u` update later on updateFlake = "git+https://git.dynamicdiscord.de/kalipso/infrastructure?ref=microvm"; }; }; in - mkIf (lib.length cfg.deployHosts != 0) builtins.listToAttrs (map mapperFunc cfg.deployHosts); }; }