nixos-build-vms
8
NixOS

# `nixos-build-vms`

build a network of virtual machines from a network of NixOS configurations

        nixos-build-vms
        --show-trace
        --no-out-link
        --help
        network.nix

## Description

This command builds a network of QEMU-KVM virtual machines of a Nix expression specifying a network of NixOS machines. The virtual network can be started by executing the `bin/run-vms` shell script that is generated by this command. By default, a `result` symlink is produced that points to the generated virtual network.

A network Nix expression has the following structure:

    {
      test1 = {pkgs, config, ...}:
        {
          services.openssh.enable = true;
          nixpkgs.system = "i686-linux";
          deployment.targetHost = "test1.example.net";

          # Other NixOS options
        };

      test2 = {pkgs, config, ...}:
        {
          services.openssh.enable = true;
          services.httpd.enable = true;
          environment.systemPackages = [ pkgs.lynx ];
          nixpkgs.system = "x86_64-linux";
          deployment.targetHost = "test2.example.net";

          # Other NixOS options
        };
    }

Each attribute in the expression represents a machine in the network (e.g. `test1` and `test2`) referring to a function defining a NixOS configuration. In each NixOS configuration, two attributes have a special meaning. The `deployment.targetHost` specifies the address (domain name or IP address) of the system which is used by `ssh` to perform remote deployment operations. The `nixpkgs.system` attribute can be used to specify an architecture for the target machine, such as `i686-linux` which builds a 32-bit NixOS configuration. Omitting this property will build the configuration for the same architecture as the host system.

## Options

This command accepts the following options:

`--show-trace`

  Shows a trace of the output.

`--no-out-link`

  Do not create a 'result' symlink.

`-h`, `--help`

  Shows the usage of this command to the user.