1
0
Fork 0
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:
Eelco Dolstra 2019-05-28 12:58:28 +02:00
parent de36cf3db9
commit 6d7efcfaeb
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
4 changed files with 29 additions and 32 deletions

View file

@ -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);