3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/modules/installer/tools
Rickard Nilsson ca0c460406 nixos-rebuild: Add option for building and/or deploying on a remote host
This commit adds the options --build-host and --target-host to nixos-rebuild.

--build-host instructs nixos-rebuild to perform all nix builds on the
specified host (via ssh). Build results are then copied back to the
local machine and used when activating the system.

--build-target instructs nixos-rebuild to activate the configuration
not on the local machine but on the specified remote host. Build
results are copied to the target machine and then activated there (via ssh).

It is possible to combine the usage of --build-host and --target-host,
in which case you can perform the build on one remote machine and deploy
the configuration to another remote machine. The only requirement is that
the build host has a working ssh connection to the target host (if the
target is not local), and that the local machine can connect to both
the target and the build host. Also, your user must be allowed to copy
nix closures between the local machine and the target and host machines.

At no point in time are the configuration sources (the nix files) copied
anywhere. Instead, nix evaluation always happens locally
(with nix-instantiate). The drv-file is then copied and realised remotely
(with nix-store).

As a convenience, if only --target-host is specified, --build-host is
implicitly set to that host too. So if you want to build locally and deploy
remotely you have to explicitly set "--build-host localhost".

To activate (test, boot or switch) you need to have root access to the
target host. You can specify this by "--target-host root@myhost".

I have tested the obvious scenarios and they are working. Some of the
combinations of --build-host and --target-host and the various actions might
not make much sense, and should maybe be forbidden (like setting a remote
target host when building a VM), and some combinations might not work at all.
2016-01-01 18:21:59 +01:00
..
nixos-build-vms Remove some obsolete references to <nixos> 2015-08-05 17:37:08 +02:00
auto-upgrade.nix nixos autoUpgrade: add a 'dates' option 2015-12-19 08:46:13 +01:00
get-version-suffix Mark builds from git explicitly 2014-05-01 15:05:14 +02:00
nixos-checkout.nix Unify NixOS and Nixpkgs channel structure 2015-08-05 17:37:11 +02:00
nixos-generate-config.pl nixos-generate-config: look at mmc_host for device drivers 2015-10-16 17:41:15 +11:00
nixos-install.sh nixos-install: Don't use NIX_BUILD_HOOK from caller's environment 2015-09-30 23:02:21 +03:00
nixos-option.sh Merge pull request #5416 from nbp/nixos-option-include 2014-12-21 15:11:11 -08:00
nixos-rebuild.sh nixos-rebuild: Add option for building and/or deploying on a remote host 2016-01-01 18:21:59 +01:00
nixos-version.sh Add option to display git revision to nixos-version 2014-12-27 21:43:04 +01:00
tools.nix Add auto update feature 2015-08-07 05:37:31 +02:00