server10: set microvm.autostart from all nixosConfigurations

This commit is contained in:
Astro 2022-06-16 22:42:03 +02:00
parent e87daaee2f
commit 137769da25
2 changed files with 15 additions and 2 deletions

View File

@ -617,6 +617,7 @@
modules = [
./hosts/server10
microvm.nixosModules.host
{ _module.args = { inherit self; }; }
];
};

View File

@ -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" ];