mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +02:00
Use enum and predicates rather than bitfile for derivation type
This commit is contained in:
parent
6b7f4ec4ab
commit
2500403059
3 changed files with 54 additions and 25 deletions
|
@ -34,21 +34,24 @@ 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,
|
||||
enum struct DerivationType : uint8_t {
|
||||
Regular,
|
||||
CAFixed,
|
||||
};
|
||||
|
||||
/* Do the outputs of the derivation have paths calculated from their content,
|
||||
or from the derivation itself? */
|
||||
bool derivationIsCA(DerivationType);
|
||||
|
||||
/* Is the content of the outputs fixed a-priori via a hash? Never true for
|
||||
non-CA derivations. */
|
||||
bool derivationIsFixed(DerivationType);
|
||||
|
||||
/* Is the derivation impure and needs to access non-deterministic resources, or
|
||||
pure and can be sandboxed? Note that whether or not we actually sandbox the
|
||||
derivation is controlled separately. Never true for non-CA derivations. */
|
||||
bool derivationIsImpure(DerivationType);
|
||||
|
||||
struct BasicDerivation
|
||||
{
|
||||
DerivationOutputs outputs; /* keyed on symbolic IDs */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue