nixos-build-vms8NixOSnixos-build-vmsbuild a network of virtual machines from a network of NixOS configurationsnixos-deploy-networknetwork.nixDescriptionThis 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.
This command also provides the option,
which spawns UNIX domain sockets in the current working directory by using the
socat command. This allows
users to remotely script a generated virtual machine.A network Nix expression has the following structure:
{
test1 = {pkgs, config, ...}:
{
services.openssh.enable = true;
nixpkgs.system = "i686-linux";
deployment.hostname = "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.hostname = "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.hostname specifies the hostname
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.
OptionsThis command accepts the following options:Indicates that the backdoor must be enabled so that the VMs can be
accessed through a UNIX domain socket. The UNIX domain sockets are
created in the current working directory.Shows a trace of the output.Do not create a 'result' symlink., Shows the usage of this command to the user.Environment variablesNIXOSPath to the NixOS source tree. Defaults to
/etc/nixos/nixos.NIXPKGS_ALLPath to the Nixpkgs source tree. Defaults to
/etc/nixos/nixpkgs.