1 <refentry xmlns="http://docbook.org/ns/docbook"
2 xmlns:xlink="http://www.w3.org/1999/xlink"
3 xmlns:xi="http://www.w3.org/2001/XInclude">
5 <refentrytitle><command>nixos-build-vms</command>
6 </refentrytitle><manvolnum>8</manvolnum>
7 <refmiscinfo class="source">NixOS</refmiscinfo>
8 <!-- <refmiscinfo class="version"><xi:include href="version.txt" parse="text"/></refmiscinfo> -->
11 <refname><command>nixos-build-vms</command></refname>
12 <refpurpose>build a network of virtual machines from a network of NixOS configurations</refpurpose>
16 <command>nixos-build-vms</command>
18 <option>--show-trace</option>
22 <option>--no-out-link</option>
26 <option>--help</option>
30 <option>--option</option>
31 <replaceable>name</replaceable>
32 <replaceable>value</replaceable>
36 <replaceable>network.nix</replaceable>
41 <title>Description</title>
43 This command builds a network of QEMU-KVM virtual machines of a Nix
44 expression specifying a network of NixOS machines. The virtual network can
45 be started by executing the <filename>bin/run-vms</filename> shell script
46 that is generated by this command. By default, a <filename>result</filename>
47 symlink is produced that points to the generated virtual network.
50 A network Nix expression has the following structure:
53 test1 = {pkgs, config, ...}:
55 services.openssh.enable = true;
56 nixpkgs.localSystem.system = "i686-linux";
57 deployment.targetHost = "test1.example.net";
62 test2 = {pkgs, config, ...}:
64 services.openssh.enable = true;
65 services.httpd.enable = true;
66 environment.systemPackages = [ pkgs.lynx ];
67 nixpkgs.localSystem.system = "x86_64-linux";
68 deployment.targetHost = "test2.example.net";
74 Each attribute in the expression represents a machine in the network (e.g.
75 <varname>test1</varname> and <varname>test2</varname>) referring to a
76 function defining a NixOS configuration. In each NixOS configuration, two
77 attributes have a special meaning. The
78 <varname>deployment.targetHost</varname> specifies the address (domain name
79 or IP address) of the system which is used by <command>ssh</command> to
80 perform remote deployment operations. The
81 <varname>nixpkgs.localSystem.system</varname> attribute can be used to
82 specify an architecture for the target machine, such as
83 <varname>i686-linux</varname> which builds a 32-bit NixOS configuration.
84 Omitting this property will build the configuration for the same
85 architecture as the host system.
89 <title>Options</title>
91 This command accepts the following options:
96 <option>--show-trace</option>
100 Shows a trace of the output.
106 <option>--no-out-link</option>
110 Do not create a 'result' symlink.
116 <option>-h</option>, <option>--help</option>
120 Shows the usage of this command to the user.
126 <option>--option</option> <replaceable>name</replaceable> <replaceable>value</replaceable>
129 <para>Set the Nix configuration option
130 <replaceable>name</replaceable> to <replaceable>value</replaceable>.
131 This overrides settings in the Nix configuration file (see
132 <citerefentry><refentrytitle>nix.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>).