Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
derivations.hh File Reference
#include "nix/store/path.hh"
#include "nix/util/types.hh"
#include "nix/util/hash.hh"
#include "nix/store/content-address.hh"
#include "nix/util/repair-flag.hh"
#include "nix/store/derivation/output.hh"
#include "nix/store/derived-path-map.hh"
#include "nix/store/parsed-derivations.hh"
#include "nix/util/sync.hh"
#include "nix/util/variant-wrapper.hh"
#include "nix/util/fun.hh"
#include <boost/unordered/concurrent_flat_map_fwd.hpp>
#include <variant>

Go to the source code of this file.

Classes

struct  nix::derivation::Type
struct  nix::derivation::Type::InputAddressed
struct  nix::derivation::Type::ContentAddressed
struct  nix::derivation::Type::Impure
struct  nix::derivation::Derivation< Inputs, Out >

Namespaces

namespace  nix::derivation

Typedefs

typedef std::map< StorePath, StringSet > nix::derivation::Inputs
using nix::derivation::Basic = Derivation<StorePathSet>
 Derivation that depends only on other store objects.
using nix::derivation::Full = Derivation<std::set<SingleDerivedPath>>
 Derivation that depends on the outputs of other derivations in addition.
using nix::derivation::ReadDerivation = fun<Full(const StorePath & drvPath)>
using nix::derivation::FullDeferred = Derivation<std::set<SingleDerivedPath>, Output::Deferred>
 Full, but statically known to have no output paths yet.
using nix::derivation::FullInputAddressed = Derivation<std::set<SingleDerivedPath>, Output::InputAddressed>
 Full, but statically known to be input-addressed.

Functions

ReadDerivation nix::derivation::readInvalid (Store &store)
template<typename Inputs>
Type nix::derivation::type (const Derivation< Inputs, Output > &drv)
template<typename Inputs>
OutputsAndOptPaths nix::derivation::outputsAndOptPaths (const Derivation< Inputs, Output > &drv, const StoreDirConfig &store)
bool nix::derivation::hasDynamicDrvDep (const std::set< SingleDerivedPath > &inputs)
void nix::derivation::checkInvariants (const Basic &drv, const StoreDirConfig &store)
void nix::derivation::checkInvariants (const Full &drv, Store &store)
void nix::derivation::checkInvariants (const Full &drv, const StoreDirConfig &store, ReadDerivation &readDerivation)
template<typename Inputs>
void nix::derivation::checkInvariants (const Derivation< Inputs, Output > &drv, Store &store, const StorePath &drvPath)
template<typename Inputs>
void nix::derivation::checkInvariants (const Derivation< Inputs, Output > &drv, const StoreDirConfig &store, auto &&readDerivation, const StorePath &drvPath)
void nix::derivation::fillInOutputPaths (Basic &drv, const StoreDirConfig &store)
void nix::derivation::fillInOutputPaths (Full &drv, Store &store)
void nix::derivation::fillInOutputPaths (Full &drv, const StoreDirConfig &store, ReadDerivation &readDerivation)
std::optional< FullInputAddressed > nix::derivation::fillInOutputPaths (FullDeferred drv, const StoreDirConfig &store, ReadDerivation &readDerivation)
Full nix::derivation::parseJsonAndValidate (Store &store, const nlohmann::json &json)
StorePath nix::computeStorePath (const StoreDirConfig &store, const Derivation &drv)
bool nix::isDerivation (std::string_view fileName)
std::string nix::outputPathName (std::string_view drvName, OutputNameView outputName)
std::string nix::hashPlaceholder (const OutputNameView outputName)
template<typename Inputs>
 nlohmann::JSON_IMPL_WITH_XP_FEATURES_INNER (nix::derivation::Derivation< Inputs >)

Variables

constexpr unsigned nix::expectedJsonVersionDerivation = 4

Function Documentation

◆ computeStorePath()

StorePath nix::computeStorePath ( const StoreDirConfig & store,
const Derivation & drv )

Compute the store path that would be used for a derivation without writing it.

This is a pure computation based on the derivation content and store directory.

◆ hashPlaceholder()

std::string nix::hashPlaceholder ( const OutputNameView outputName)

This creates an opaque and almost certainly unique string deterministically from the output name.

It is used as a placeholder to allow derivations to refer to their own outputs without needing to use the hash of a derivation in itself, making the hash near-impossible to calculate.

◆ isDerivation()

bool nix::isDerivation ( std::string_view fileName)
Todo
Remove.

Use Path::isDerivation instead.

◆ outputPathName()

std::string nix::outputPathName ( std::string_view drvName,
OutputNameView outputName )

Calculate the name that will be used for the store path for this output.

This is usually <drv-name>-<output-name>, but is just <drv-name> when the output name is "out".

Variable Documentation

◆ expectedJsonVersionDerivation

unsigned nix::expectedJsonVersionDerivation = 4
constexpr

The expected JSON version for derivation serialization. Used by nix derivation show and nix derivation add.