![]() |
Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
|
#include <build.hh>
Public Member Functions | |
| virtual void | anchor () |
| virtual void | buildPaths (const std::vector< DerivedPath > &reqs, BuildMode buildMode=bmNormal)=0 |
| virtual std::vector< KeyedBuildResult > | buildPathsWithResults (const std::vector< DerivedPath > &reqs, BuildMode buildMode=bmNormal)=0 |
| virtual BuildResult | buildDerivation (const StorePath &drvPath, const BasicDerivation &drv, BuildMode buildMode=bmNormal)=0 |
| virtual void | ensurePath (const StorePath &path)=0 |
| virtual void | repairPath (const StorePath &path)=0 |
Abstract interface for the build scheduler entry points.
Worker implements this for local scheduling, including local builds. Remote stores provide a Builder via Store::getBuilder().
Thread safety should be guaranteed across these methods.
|
pure virtual |
Build a single non-materialized derivation (i.e. not from an on-disk .drv file).
| drvPath | This is used to deduplicate worker goals so it is imperative that is correct. That said, it doesn't literally need to be store path that would be calculated from writing this derivation to the store: it is OK if it instead is that of a Derivation which would resolve to this (by taking the outputs of it's input derivations and adding them as input sources) such that the build time referenceable-paths are the same. |
In the input-addressed case, we usually do use an "original" unresolved derivations's path, as that is what will be used in the buildPaths case. Also, the input-addressed output paths are verified only by that contents of that specific unresolved derivation, so it is nice to keep that information around so if the original derivation is ever obtained later, it can be verified whether the trusted user in fact used the proper output path.
In the content-addressed case, we want to always use the resolved drv path calculated from the provided derivation. This serves two purposes:
Implemented in nix::LegacySSHBuilder, nix::LocalBuilder, nix::RemoteBuilder, nix::RestrictedBuilder, and nix::Worker.
|
pure virtual |
For each path, if it's a derivation, build it. Building a derivation means ensuring that the output paths are valid. If they are already valid, this is a no-op. Otherwise, validity can be reached in two ways. First, if the output paths is substitutable, then build the path that way. Second, the output paths can be created by running the builder, after recursively building any sub-derivations. For inputs that are not derivations, substitute them.
Implemented in nix::LegacySSHBuilder, nix::LocalBuilder, nix::RemoteBuilder, nix::RestrictedBuilder, and nix::Worker.
|
pure virtual |
Like buildPaths(), but return a vector of BuildResult BuildResults corresponding to each element in paths. Note that in case of a build/substitution error, this function won't throw an exception, but return a BuildResult containing an error message.
Implemented in nix::LegacySSHBuilder, nix::LocalBuilder, nix::RemoteBuilder, nix::RestrictedBuilder, and nix::Worker.
|
pure virtual |
Ensure that a path is valid. If it is not currently valid, it may be made valid by running a substitute (if defined for the path).
The path is registered as a temporary GC root first, whether or not it was already valid, so that a concurrent garbage collection cannot delete it while the caller is still using it.
Implemented in nix::LegacySSHBuilder, nix::LocalBuilder, nix::RemoteBuilder, nix::RestrictedBuilder, and nix::Worker.
|
pure virtual |
Repair the contents of the given path by redownloading it using a substituter (if available).
Implemented in nix::LegacySSHBuilder, nix::LocalBuilder, nix::RemoteBuilder, nix::RestrictedBuilder, and nix::Worker.