mirror of
https://github.com/NixOS/nix
synced 2025-07-02 17:41:48 +02:00
Generalize isFixedOutput
in preparation for CA drvs
Today's fixed output derivations and regular derivations differ in a few ways which are largely orthogonal. This replaces `isFixedOutput` with a `type` that returns an enum of possible combinations.
This commit is contained in:
parent
b79b81dd2d
commit
2be64efb02
4 changed files with 106 additions and 40 deletions
|
@ -22,6 +22,7 @@ struct DerivationOutput
|
|||
, hashAlgo(std::move(hashAlgo))
|
||||
, hash(std::move(hash))
|
||||
{ }
|
||||
void parseHashType(bool & recursive, HashType & hashType) const;
|
||||
void parseHashInfo(bool & recursive, Hash & hash) const;
|
||||
};
|
||||
|
||||
|
@ -33,6 +34,21 @@ typedef std::map<StorePath, StringSet> DerivationInputs;
|
|||
|
||||
typedef std::map<string, string> StringPairs;
|
||||
|
||||
// Bit:
|
||||
// 7: regular vs ca
|
||||
// 6: floating vs fixed hash if ca, regular always floating
|
||||
// 5: pure vs impure if ca, regular always pure
|
||||
// _: Unassigned
|
||||
enum DerivationTypeAxis : uint8_t {
|
||||
DtAxisCA = 0b10000000,
|
||||
DtAxisFixed = 0b01000000,
|
||||
DtAxisImpure = 0b00100000,
|
||||
};
|
||||
enum DerivationType : uint8_t {
|
||||
DtRegular = 0b0000000,
|
||||
DtCAFixed = 0b11100000,
|
||||
};
|
||||
|
||||
struct BasicDerivation
|
||||
{
|
||||
DerivationOutputs outputs; /* keyed on symbolic IDs */
|
||||
|
@ -53,7 +69,7 @@ struct BasicDerivation
|
|||
bool isBuiltin() const;
|
||||
|
||||
/* Return true iff this is a fixed-output derivation. */
|
||||
bool isFixedOutput() const;
|
||||
DerivationType type() const;
|
||||
|
||||
/* Return the output paths of a derivation. */
|
||||
StorePathSet outputPaths() const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue