nixos-deploy-network8NixOSnixos-deploy-networkdeploy a network of NixOS configurations into a network of machinesnixos-deploy-networknetwork.nixDescriptionThis command automatically deploys a network of NixOS
configurations into a network of machines.
First, it tries to build all the system derivations defined
in the network expression. Then it efficiently transfers
the closures to the machines in the network. Finally, the configurations
are activated. In case of a failure, a rollback is performed,
which brings all the updated configurations back into the previous
state.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.
OptionsThis command accepts the following options:Shows a trace of the output.Do not create a 'result' symlink., Shows the usage of this command to the user.