#include "path.hh"
#include "types.hh"
#include "hash.hh"
#include "content-address.hh"
#include "repair-flag.hh"
#include "derived-path-map.hh"
#include "sync.hh"
#include "variant-wrapper.hh"
#include <map>
#include <variant>
Go to the source code of this file.
Classes | |
struct | nix::DerivationOutput |
struct | nix::DerivationOutput::InputAddressed |
struct | nix::DerivationOutput::CAFixed |
struct | nix::DerivationOutput::CAFloating |
struct | nix::DerivationOutput::Deferred |
struct | nix::DerivationOutput::Impure |
struct | nix::DerivationType |
struct | nix::DerivationType::InputAddressed |
struct | nix::DerivationType::ContentAddressed |
struct | nix::DerivationType::Impure |
struct | nix::BasicDerivation |
struct | nix::Derivation |
struct | nix::DrvHash |
Typedefs | |
typedef std::map< std::string, DerivationOutput > | nix::DerivationOutputs |
typedef std::map< std::string, std::pair< DerivationOutput, std::optional< StorePath > > > | nix::DerivationOutputsAndOptPaths |
typedef std::map< StorePath, StringSet > | nix::DerivationInputs |
typedef std::map< StorePath, DrvHash > | nix::DrvHashes |
Functions | |
StorePath | nix::writeDerivation (Store &store, const Derivation &drv, RepairFlag repair, bool readOnly) |
Derivation | nix::parseDerivation (const StoreDirConfig &store, std::string &&s, std::string_view name, const ExperimentalFeatureSettings &xpSettings) |
bool | nix::isDerivation (std::string_view fileName) |
std::string | nix::outputPathName (std::string_view drvName, OutputNameView outputName) |
void | nix::operator|= (DrvHash::Kind &self, const DrvHash::Kind &other) noexcept |
DrvHash | nix::hashDerivationModulo (Store &store, const Derivation &drv, bool maskOutputs) |
std::map< std::string, Hash > | nix::staticOutputHashes (Store &store, const Derivation &drv) |
Source & | nix::readDerivation (Source &in, const StoreDirConfig &store, BasicDerivation &drv, std::string_view name) |
void | nix::writeDerivation (Sink &out, const StoreDirConfig &store, const BasicDerivation &drv) |
std::string | nix::hashPlaceholder (const OutputNameView outputName) |
typedef std::map<StorePath, StringSet> nix::DerivationInputs |
For inputs that are sub-derivations, we specify exactly which output IDs we are interested in.
typedef std::map<std::string, std::pair<DerivationOutput, std::optional<StorePath> > > nix::DerivationOutputsAndOptPaths |
These are analogues to the previous DerivationOutputs data type, but they also contains, for each output, the (optional) store path in which it would be written. To calculate values of these types, see the corresponding functions in BasicDerivation.
typedef std::map<StorePath, DrvHash> nix::DrvHashes |
Memoisation of hashDerivationModulo().
DrvHash nix::hashDerivationModulo | ( | Store & | store, |
const Derivation & | drv, | ||
bool | maskOutputs ) |
Returns hashes with the details of fixed-output subderivations expunged.
A fixed-output derivation is a derivation whose outputs have a specified content hash and hash algorithm. (Currently they must have exactly one output (out
), which is specified using the outputHash
and outputHashAlgo
attributes, but the algorithm doesn't assume this.) We don't want changes to such derivations to propagate upwards through the dependency graph, changing output paths everywhere.
For instance, if we change the url in a call to the fetchurl
function, we do not want to rebuild everything depending on it—after all, (the hash of) the file being downloaded is unchanged. So the output paths should not change. On the other hand, the derivation paths should change to reflect the new dependency graph.
For fixed-output derivations, this returns a map from the name of each output to its hash, unique up to the output's contents.
For regular derivations, it returns a single hash of the derivation ATerm, after subderivations have been likewise expunged from that derivation.
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.
bool nix::isDerivation | ( | std::string_view | fileName | ) |
Use Path::isDerivation instead.
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".
Derivation nix::parseDerivation | ( | const StoreDirConfig & | store, |
std::string && | s, | ||
std::string_view | name, | ||
const ExperimentalFeatureSettings & | xpSettings = experimentalFeatureSettings ) |
Read a derivation from a file.
std::map< std::string, Hash > nix::staticOutputHashes | ( | Store & | store, |
const Derivation & | drv ) |
Return a map associating each output to a hash that uniquely identifies its derivation (modulo the self-references).
StorePath nix::writeDerivation | ( | Store & | store, |
const Derivation & | drv, | ||
RepairFlag | repair = NoRepair, | ||
bool | readOnly = false ) |
Write a derivation to the Nix store, and return its path.