diff --git a/flake.nix b/flake.nix index cd1cad78..a4615589 100644 --- a/flake.nix +++ b/flake.nix @@ -617,6 +617,7 @@ modules = [ ./hosts/server10 microvm.nixosModules.host + { _module.args = { inherit self; }; } ]; }; diff --git a/hosts/server10/microvms.nix b/hosts/server10/microvms.nix index c20ba948..08b7efc5 100644 --- a/hosts/server10/microvms.nix +++ b/hosts/server10/microvms.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ self, config, lib, pkgs, ... }: { options = with lib; { c3d2.deployment.microvmBaseZfsDataset = mkOption { @@ -8,7 +8,19 @@ }; config = { - microvm.autostart = [ "oparl" "leon" "nfsroot" "freifunk" ]; + microvm.autostart = + # static list of microvms from other sources + [ "staging-data-hoarder" ] + ++ + # just all the microvms from this flake + # that are supposed to run on the server + builtins.filter (name: + self.nixosConfigurations.${name} + .config ? c3d2.deployment.server + && self.nixosConfigurations.${name} + .config.c3d2.deployment.server + == config.networking.hostName + ) (builtins.attrNames self.nixosConfigurations); systemd.services."microvm-virtiofsd@" = { requires = [ "microvm-zfs-datasets@%i.service" ];