diff --git a/flake.nix b/flake.nix index 47c40834..8f51710f 100644 --- a/flake.nix +++ b/flake.nix @@ -694,6 +694,7 @@ modules = [ ./hosts/server9 microvm.nixosModules.host + self.nixosModules.microvm-host self.nixosModules.cluster-network self.nixosModules.cluster { _module.args = { inherit self; }; } @@ -704,6 +705,7 @@ modules = [ ./hosts/server10 microvm.nixosModules.host + self.nixosModules.microvm-host self.nixosModules.cluster-network self.nixosModules.cluster { _module.args = { inherit self; }; } @@ -789,6 +791,7 @@ microvm.nixosModules.microvm ./modules/microvm.nix ]; + microvm-host = ./modules/microvm-host.nix; nncp = ./modules/nncp.nix; plume = { imports = [ ./modules/plume.nix ]; diff --git a/hosts/server10/default.nix b/hosts/server10/default.nix index a89d682d..8e985d9f 100644 --- a/hosts/server10/default.nix +++ b/hosts/server10/default.nix @@ -4,7 +4,6 @@ imports = [ ./hardware-configuration.nix ./microvm-staging.nix - ./microvms.nix ]; c3d2 = { @@ -45,5 +44,11 @@ zfs.autoScrub.enable = true; }; + # static list of microvms from other sources + microvm.autostart = [ + "data-hoarder" + "staging-data-hoarder" + ]; + system.stateVersion = "21.11"; # Did you read the comment? } diff --git a/hosts/server9/default.nix b/hosts/server9/default.nix index 985b38f5..682bff92 100644 --- a/hosts/server9/default.nix +++ b/hosts/server9/default.nix @@ -31,7 +31,10 @@ services.zfs.autoScrub.enable = true; services.smartd.enable = true; - c3d2.hq.statistics.enable = true; + c3d2 = { + deployment.microvmBaseZfsDataset = "tank/storage"; + hq.statistics.enable = true; + }; # XXX: enable for zw-ev and poelzi-ha until we find a better solution virtualisation.libvirtd = { diff --git a/hosts/server10/microvms.nix b/modules/microvm-host.nix similarity index 81% rename from hosts/server10/microvms.nix rename to modules/microvm-host.nix index f0b48fde..60d3b33f 100644 --- a/hosts/server10/microvms.nix +++ b/modules/microvm-host.nix @@ -8,21 +8,14 @@ }; config = { + # just all the microvms from this flake + # that are supposed to run on the server microvm.autostart = - # static list of microvms from other sources - [ - "data-hoarder" - "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 + let + inherit (self.nixosConfigurations.${name}) config; + in + (config.c3d2.deployment.server or null) == config.networking.hostName ) (builtins.attrNames self.nixosConfigurations); systemd.services."microvm-virtiofsd@" = {