mirror of
https://github.com/NixOS/nix
synced 2025-07-04 11:21:47 +02:00
Store SourceInfo in Flake and NonFlake
This deduplicates some shared fields. Factoring out the commonality is useful in places like makeFlakeValue().
This commit is contained in:
parent
de36cf3db9
commit
6d7efcfaeb
4 changed files with 29 additions and 32 deletions
|
@ -94,17 +94,15 @@ struct Flake
|
|||
FlakeRef originalRef;
|
||||
FlakeRef resolvedRef;
|
||||
std::string description;
|
||||
std::optional<uint64_t> revCount;
|
||||
Path storePath;
|
||||
SourceInfo sourceInfo;
|
||||
Hash hash; // content hash
|
||||
std::vector<FlakeRef> requires;
|
||||
std::map<FlakeAlias, FlakeRef> nonFlakeRequires;
|
||||
Value * vProvides; // FIXME: gc
|
||||
// date
|
||||
unsigned int epoch;
|
||||
|
||||
Flake(const FlakeRef & origRef, const SourceInfo & sourceInfo) : originalRef(origRef),
|
||||
resolvedRef(sourceInfo.resolvedRef), revCount(sourceInfo.revCount), storePath(sourceInfo.storePath) {};
|
||||
resolvedRef(sourceInfo.resolvedRef), sourceInfo(sourceInfo) {};
|
||||
};
|
||||
|
||||
struct NonFlake
|
||||
|
@ -112,12 +110,10 @@ struct NonFlake
|
|||
FlakeAlias alias;
|
||||
FlakeRef originalRef;
|
||||
FlakeRef resolvedRef;
|
||||
std::optional<uint64_t> revCount;
|
||||
SourceInfo sourceInfo;
|
||||
Hash hash;
|
||||
Path storePath;
|
||||
// date
|
||||
NonFlake(const FlakeRef & origRef, const SourceInfo & sourceInfo) : originalRef(origRef),
|
||||
resolvedRef(sourceInfo.resolvedRef), revCount(sourceInfo.revCount), storePath(sourceInfo.storePath) {};
|
||||
NonFlake(const FlakeRef & origRef, const SourceInfo & sourceInfo) :
|
||||
originalRef(origRef), resolvedRef(sourceInfo.resolvedRef), sourceInfo(sourceInfo) {};
|
||||
};
|
||||
|
||||
Flake getFlake(EvalState &, const FlakeRef &, bool impureIsAllowed);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue