2014-02-10 13:43:13 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
|
|
|
#define SERVE_MAGIC_1 0x390c9deb
|
|
|
|
#define SERVE_MAGIC_2 0x5452eecb
|
|
|
|
|
2018-08-03 21:10:03 +02:00
|
|
|
#define SERVE_PROTOCOL_VERSION 0x205
|
2014-02-10 13:43:13 +01:00
|
|
|
#define GET_PROTOCOL_MAJOR(x) ((x)&0xff00)
|
|
|
|
#define GET_PROTOCOL_MINOR(x) ((x)&0x00ff)
|
|
|
|
|
2020-08-21 04:23:04 +02:00
|
|
|
using ServeCommand = enum {
|
2014-07-10 11:51:22 +02:00
|
|
|
cmdQueryValidPaths = 1,
|
|
|
|
cmdQueryPathInfos = 2,
|
|
|
|
cmdDumpStorePath = 3,
|
|
|
|
cmdImportPaths = 4,
|
2014-07-11 16:02:19 +02:00
|
|
|
cmdExportPaths = 5,
|
|
|
|
cmdBuildPaths = 6,
|
2014-07-24 16:00:29 +02:00
|
|
|
cmdQueryClosure = 7,
|
Allow remote builds without sending the derivation closure
Previously, to build a derivation remotely, we had to copy the entire
closure of the .drv file to the remote machine, even though we only
need the top-level derivation. This is very wasteful: the closure can
contain thousands of store paths, and in some Hydra use cases, include
source paths that are very large (e.g. Git/Mercurial checkouts).
So now there is a new operation, StoreAPI::buildDerivation(), that
performs a build from an in-memory representation of a derivation
(BasicDerivation) rather than from a on-disk .drv file. The only files
that need to be in the Nix store are the sources of the derivation
(drv.inputSrcs), and the needed output paths of the dependencies (as
described by drv.inputDrvs). "nix-store --serve" exposes this
interface.
Note that this is a privileged operation, because you can construct a
derivation that builds any store path whatsoever. Fixing this will
require changing the hashing scheme (i.e., the output paths should be
computed from the other fields in BasicDerivation, allowing them to be
verified without access to other derivations). However, this would be
quite nice because it would allow .drv-free building (e.g. "nix-env
-i" wouldn't have to write any .drv files to disk).
Fixes #173.
2015-07-17 17:57:40 +02:00
|
|
|
cmdBuildDerivation = 8,
|
2018-08-03 21:10:03 +02:00
|
|
|
cmdAddToStoreNar = 9,
|
2020-08-21 04:23:04 +02:00
|
|
|
};
|
2014-02-10 13:43:13 +01:00
|
|
|
|
|
|
|
} // namespace nix
|