2020-10-11 19:17:24 +03:00
|
|
|
#pragma once
|
2023-04-01 06:18:41 +03:00
|
|
|
///@file
|
2020-10-11 19:17:24 +03:00
|
|
|
|
2020-10-12 20:16:13 +03:00
|
|
|
#include "logging.hh"
|
|
|
|
#include "serialise.hh"
|
2023-10-25 07:43:36 +03:00
|
|
|
#include "processes.hh"
|
2009-01-12 18:30:32 +02:00
|
|
|
|
2006-09-05 00:06:23 +03:00
|
|
|
namespace nix {
|
|
|
|
|
2020-10-11 19:17:24 +03:00
|
|
|
struct HookInstance
|
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 18:57:40 +03:00
|
|
|
{
|
2023-04-07 16:55:28 +03:00
|
|
|
/**
|
|
|
|
* Pipes for talking to the build hook.
|
|
|
|
*/
|
2020-10-11 19:17:24 +03:00
|
|
|
Pipe toHook;
|
2018-09-28 13:43:01 +03:00
|
|
|
|
2023-04-07 16:55:28 +03:00
|
|
|
/**
|
|
|
|
* Pipe for the hook's standard output/error.
|
|
|
|
*/
|
2020-10-11 19:17:24 +03:00
|
|
|
Pipe fromHook;
|
2018-09-28 13:43:01 +03:00
|
|
|
|
2023-04-07 16:55:28 +03:00
|
|
|
/**
|
|
|
|
* Pipe for the builder's standard output/error.
|
|
|
|
*/
|
2020-10-11 19:17:24 +03:00
|
|
|
Pipe builderOut;
|
2005-01-25 12:55:33 +02:00
|
|
|
|
2023-04-07 16:55:28 +03:00
|
|
|
/**
|
|
|
|
* The process ID of the hook.
|
|
|
|
*/
|
2020-10-11 19:17:24 +03:00
|
|
|
Pid pid;
|
2005-01-25 12:55:33 +02:00
|
|
|
|
2020-10-11 19:17:24 +03:00
|
|
|
FdSink sink;
|
2005-01-25 12:55:33 +02:00
|
|
|
|
2020-10-11 19:17:24 +03:00
|
|
|
std::map<ActivityId, Activity> activities;
|
2005-01-25 15:00:12 +02:00
|
|
|
|
2020-10-11 19:17:24 +03:00
|
|
|
HookInstance();
|
2013-01-02 13:38:28 +02:00
|
|
|
|
2020-10-11 19:17:24 +03:00
|
|
|
~HookInstance();
|
|
|
|
};
|
2005-01-25 15:00:12 +02:00
|
|
|
|
2006-09-05 00:06:23 +03:00
|
|
|
}
|