From 47ed06a290c66d41622c096c28da5b1c71be885b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 14 Dec 2014 03:37:41 +0100 Subject: [PATCH] Add a section on nix-serve --- .../packages/binary-cache-substituter.xml | 70 +++++++++++++++++++ doc/manual/packages/copy-closure.xml | 2 +- doc/manual/packages/sharing-packages.xml | 1 + 3 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 doc/manual/packages/binary-cache-substituter.xml diff --git a/doc/manual/packages/binary-cache-substituter.xml b/doc/manual/packages/binary-cache-substituter.xml new file mode 100644 index 000000000..c6ceb9c80 --- /dev/null +++ b/doc/manual/packages/binary-cache-substituter.xml @@ -0,0 +1,70 @@ +
+ +Serving a Nix store via HTTP + +You can easily share the Nix store of a machine via HTTP. This +allows other machines to fetch store paths from that machine to speed +up installations. It uses the same binary cache +mechanism that Nix usually uses to fetch pre-built binaries from +https://cache.nixos.org. + +The daemon that handles binary cache requests via HTTP, +nix-serve, is not part of the Nix distribution, but +you can install it from Nixpkgs: + + +$ nix-env -i nix-serve + + +You can then start the server, listening for HTTP connections on +whatever port you like: + + +$ nix-serve -p 8080 + + +To check whether it works, try the following on the client: + + +$ curl http://avalon:8080/nix-cache-info + + +which should print something like: + + +StoreDir: /nix/store +WantMassQuery: 1 +Priority: 30 + + + + +On the client side, you can tell Nix to use your binary cache +using , e.g.: + + +$ nix-env -i firefox --option extra-binary-caches http://avalon:8080/ + + +The option tells Nix to use this +binary cache in addition to your default caches, such as +https://cache.nixos.org. Thus, for any path in the closure +of Firefox, Nix will first check if the path is available on the +server avalon or another binary caches. If not, it +will fall back to building from source. + +You can also tell Nix to always use your binary cache by adding +a line to the nix.conf +configuration file like this: + + +binary-caches = http://avalon:8080/ https://cache.nixos.org/ + + + + +
diff --git a/doc/manual/packages/copy-closure.xml b/doc/manual/packages/copy-closure.xml index 5ec7896d8..012030e3e 100644 --- a/doc/manual/packages/copy-closure.xml +++ b/doc/manual/packages/copy-closure.xml @@ -4,7 +4,7 @@ version="5.0" xml:id="ssec-copy-closure"> -Copying Closures +Copying Closures Via SSH The command nix-copy-closure copies a Nix diff --git a/doc/manual/packages/sharing-packages.xml b/doc/manual/packages/sharing-packages.xml index 586363b03..8465c182e 100644 --- a/doc/manual/packages/sharing-packages.xml +++ b/doc/manual/packages/sharing-packages.xml @@ -12,6 +12,7 @@ another machine already has some or all of those packages or their dependencies. In that case there are mechanisms to quickly copy packages between machines. +