Skip to content

Latest commit

 

History

History
45 lines (39 loc) · 1.39 KB

host.md

File metadata and controls

45 lines (39 loc) · 1.39 KB

Preparing a NixOS host for declarative MicroVMs

microvm.nix adds the following configuration for servers to host MicroVMs reliably:

Prepare your host by including the microvm.nix host nixosModule:

# Your server's flake.nix
{
  inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  inputs.microvm.url = "github:astro/microvm.nix";
  inputs.microvm.inputs.nixpkgs.follows = "nixpkgs";

  outputs = { self, nixpkgs, microvm }: {
    # Example nixosConfigurations entry
    nixosConfigurations.server1 = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        # Include the microvm host module
        microvm.nixosModules.host
        # Add more modules here
        {
          networking.hostName = "server1";

          # try to automatically start these MicroVMs on bootup
          microvm.autostart = [
            "my-microvm"
            "your-microvm"
            "their-microvm"
          ];
        }
      ];
    };
  };
}