From 137769da25e36ebd6467515095b2d4afcd39ffeb Mon Sep 17 00:00:00 2001 From: Astro Date: Thu, 16 Jun 2022 22:42:03 +0200 Subject: [PATCH] server10: set microvm.autostart from all nixosConfigurations --- flake.nix | 1 + hosts/server10/microvms.nix | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) 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" ];