2014-02-10 12:43:13 +00:00
|
|
|
#pragma once
|
2023-04-01 03:18:41 +00:00
|
|
|
///@file
|
2014-02-10 12:43:13 +00:00
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
|
|
|
#define SERVE_MAGIC_1 0x390c9deb
|
|
|
|
#define SERVE_MAGIC_2 0x5452eecb
|
|
|
|
|
2021-08-23 21:47:29 +00:00
|
|
|
#define SERVE_PROTOCOL_VERSION (2 << 8 | 7)
|
2014-02-10 12:43:13 +00:00
|
|
|
#define GET_PROTOCOL_MAJOR(x) ((x) & 0xff00)
|
|
|
|
#define GET_PROTOCOL_MINOR(x) ((x) & 0x00ff)
|
|
|
|
|
|
|
|
typedef enum {
|
2014-07-10 09:51:22 +00:00
|
|
|
cmdQueryValidPaths = 1,
|
|
|
|
cmdQueryPathInfos = 2,
|
|
|
|
cmdDumpStorePath = 3,
|
|
|
|
cmdImportPaths = 4,
|
2014-07-11 14:02:19 +00:00
|
|
|
cmdExportPaths = 5,
|
|
|
|
cmdBuildPaths = 6,
|
2014-07-24 14:00:29 +00: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 15:57:40 +00:00
|
|
|
cmdBuildDerivation = 8,
|
2018-08-03 19:10:03 +00:00
|
|
|
cmdAddToStoreNar = 9,
|
2014-02-10 12:43:13 +00:00
|
|
|
} ServeCommand;
|
|
|
|
|
|
|
|
}
|