Add the nix-store --serve command

This is essentially the substituter API operating on the local store,
which will be used by the ssh substituter. It runs in a loop rather than
just taking one command so that in the future nix will be able to keep
one connection open for multiple instances of the substituter.

Signed-off-by: Shea Levy <shea@shealevy.com>
nix-store --serve: Don't loop forever

nix-store --export takes a tmproot, which can only release by exiting.
Substituters don't currently work in a way that could take advantage of
the looping, anyway.

Signed-off-by: Shea Levy <shea@shealevy.com>
nix-store --serve: Don't fail if asked for info about non-valid path

Signed-off-by: Shea Levy <shea@shealevy.com>
nix-store --serve: Use dump instead of export

Also remove signing support

Signed-off-by: Shea Levy <shea@shealevy.com>
nix-store --serve: Flush out after every loop

Signed-off-by: Shea Levy <shea@shealevy.com>
Add download-via-ssh substituter

This substituter connects to a remote host, runs nix-store --serve
there, and then forwards substituter commands on to the remote host and
sends their results to the calling program. The ssh-substituter-hosts
option can be specified as a list of hosts to try.

This is an initial implementation and, while it works, it has some
limitations:

* Only the first host is used
* There is no caching of query results (all queries are sent to the
  remote machine)
* There is no informative output (such as progress bars)
* Some failure modes may cause unhelpful error messages
* There is no concept of trusted-ssh-substituter-hosts

Signed-off-by: Shea Levy <shea@shealevy.com>
Clarify comment

Signed-off-by: Shea Levy <shea@shealevy.com>
Pass in params by const ref

Signed-off-by: Shea Levy <shea@shealevy.com>
Move StoreApi::serve into opServe

Signed-off-by: Shea Levy <shea@shealevy.com>
nix-store --serve: Use a versioned protocol

Signed-off-by: Shea Levy <shea@shealevy.com>
Remove using declarations from download-via-ssh

Signed-off-by: Shea Levy <shea@shealevy.com>
error messages start in lowercase

Signed-off-by: Shea Levy <shea@shealevy.com>
Remove relic of old code

Signed-off-by: Shea Levy <shea@shealevy.com>
Indendation fix

Signed-off-by: Shea Levy <shea@shealevy.com>
Merge remote-tracking branch 'shlevy/ssh-substituter'
Minor style fixes
download-via-ssh: Show where we're downloading from
download-via-ssh: Use readStorePath