diff options
author | Nick Van den Broeck <nick.van.den.broeck666@gmail.com> | 2019-03-29 16:18:25 +0100 |
---|---|---|
committer | Nick Van den Broeck <nick.van.den.broeck666@gmail.com> | 2019-04-09 09:51:42 +0200 |
commit | 3ec0c82fab94533807c5c3bb25df2b43d8339ed3 (patch) | |
tree | 094f7783c21fe0f6717e0f94ad8466cd7b8888e2 /src/libexpr/primops/flake.hh | |
parent | 641db127be9df82fe4d51290120a8ba6d0b5f4fd (diff) |
Fixed dependency resolution
Diffstat (limited to 'src/libexpr/primops/flake.hh')
-rw-r--r-- | src/libexpr/primops/flake.hh | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/src/libexpr/primops/flake.hh b/src/libexpr/primops/flake.hh index a8f907784..019688f37 100644 --- a/src/libexpr/primops/flake.hh +++ b/src/libexpr/primops/flake.hh @@ -19,6 +19,20 @@ struct FlakeRegistry std::map<FlakeId, Entry> entries; }; +struct LockFile +{ + struct FlakeEntry + { + FlakeRef ref; + std::map<FlakeId, FlakeEntry> flakeEntries; + std::map<FlakeId, FlakeRef> nonFlakeEntries; + FlakeEntry(const FlakeRef & flakeRef) : ref(flakeRef) {}; + }; + + std::map<FlakeId, FlakeEntry> flakeEntries; + std::map<FlakeId, FlakeRef> nonFlakeEntries; +}; + Path getUserRegistryPath(); Value * makeFlakeRegistryValue(EvalState & state); @@ -37,7 +51,7 @@ struct Flake Path path; std::optional<uint64_t> revCount; std::vector<FlakeRef> requires; - std::shared_ptr<FlakeRegistry> lockFile; + LockFile lockFile; std::map<FlakeId, FlakeRef> nonFlakeRequires; Value * vProvides; // FIXME: gc // date @@ -55,18 +69,17 @@ struct NonFlake NonFlake(const FlakeRef flakeRef) : ref(flakeRef) {}; }; -Flake getFlake(EvalState &, const FlakeRef &); +Flake getFlake(EvalState &, const FlakeRef &, bool impureIsAllowed); struct Dependencies { - FlakeId topFlakeId; - std::vector<Flake> flakes; - std::vector<NonFlake> nonFlakes; + Flake flake; + std::vector<Dependencies> flakeDeps; // The flake dependencies + std::vector<NonFlake> nonFlakeDeps; + Dependencies(const Flake & flake) : flake(flake) {} }; -Dependencies resolveFlake(EvalState &, const FlakeRef &, bool impureTopRef); - -FlakeRegistry updateLockFile(EvalState &, Flake &); +Dependencies resolveFlake(EvalState &, const FlakeRef &, bool impureTopRef, bool isTopFlake); -void updateLockFile(EvalState &, Path); +void updateLockFile(EvalState &, Path path, bool impureTopRef); } |