nixpkgs/nixos/modules
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
..
config sysctl: use literalExample in docs 2015-12-30 10:22:04 -08:00
hardware nixos/bumblebee: update for new packages 2015-12-05 00:54:09 +03:00
installer nixos-rebuild: Add option for building and/or deploying on a remote host 2016-01-01 18:21:59 +01:00
misc Merge pull request #11956 from zimbatm/nm-openvpn-uid-gid 2015-12-27 11:02:55 +01:00
profiles Change the preset networking.hostId to use mkDefault so it can be easily changed by the user later 2015-11-22 01:03:16 +11:00
programs zsh module: add /share/zsh to pathsToLink 2015-11-26 04:33:07 +03:00
security nixos/acme: fix timer unit 2015-12-13 17:01:59 +03:00
services nixos/plex: Add 'package' option to module 2015-12-30 20:20:25 -06:00
system etc: Use a friendlier name than "etc-file" 2015-12-30 15:17:30 +01:00
tasks Network script module fix 2015-12-25 03:43:49 +03:00
testing nixos/tests: Revert setting min_free_kbytes 2015-12-14 17:40:28 +01:00
virtualisation amazon-image: enable configure-from-userdata and the corresponding VM test 2015-12-30 04:59:52 +00:00
module-list.nix WindowLab: initial pkg at 1.40 2015-12-30 11:10:30 +01:00
rename.nix hostapd: rename extraCfg -> extraConfig, added asserts 2015-12-26 11:37:00 +01:00