nix-push push store paths onto a network cache nix-push archives-put-url archives-get-url manifest-put-url paths Description The command nix-push builds a set of store expressions (if necessary), and then packages and uploads all store paths in the resulting closures to a server. A network cache thus populated can subsequently be used to speed up software deployment on other machines using the nix-pull command. nix-push performs the following actions. The store expressions stored in paths are realised (using nix-store --realise). All paths in the closure of the store expressions stored in paths are determined (using nix-store --query --requisites --include-successors). It should be noted that since the flag is used, if you specify a derivation store expression, you get a combined source/binary distribution. If you only want a binary distribution, you should specify the closure store expression that result from realising these (see below). All store paths determined in the previous step are packaged and compressed into a bzipped NAR archive (extension .nar.bz2). A manifest is created that contains information on the store paths, their eventual URLs in the cache, and cryptographic hashes of the contents of the NAR archives. Each store path is uploaded to the remote directory specified by archives-put-url. HTTP PUT requests are used to do this. However, before a file x is uploaded to archives-put-url/x, nix-push first determines whether this upload is unnecessary by issuing a HTTP HEAD request on archives-get-url/x. This allows a cache to be shared between many partially overlapping nix-push invocations. (We use two URLs because the upload URL typically refers to a CGI script, while the download URL just refers to a file system directory on the server.) The manifest is uploaded using an HTTP PUT request to manifest-put-url. The corresponding URL to download the manifest can then be used by nix-pull. Examples To upload files there typically is some CGI script on the server side. This script should be be protected with a password. The following example uploads the store paths resulting from building the Nix expressions in foo.nix, passing appropriate authentication information: $ nix-push \ http://foo@bar:server.domain/cgi-bin/upload.pl/cache \ http://server.domain/cache \ http://foo@bar:server.domain/cgi-bin/upload.pl/MANIFEST \ $(nix-instantiate foo.nix) This will push both sources and binaries (and any build-time dependencies used in the build, such as compilers). If we just want to push binaries, not sources and build-time dependencies, we can do: $ nix-push urls $(nix-instantiate $(nix-store -r foo.nix))