mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-27 08:16:14 +02:00
parent
a9ebc3ea5d
commit
af35b318f3
1 changed files with 11 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
||||||
#include "eval-inline.hh"
|
#include "eval-inline.hh"
|
||||||
#include "store-api.hh"
|
#include "store-api.hh"
|
||||||
#include "fetchers/fetchers.hh"
|
#include "fetchers/fetchers.hh"
|
||||||
|
#include "finally.hh"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
@ -387,6 +388,8 @@ LockedFlake lockFlake(
|
||||||
const InputPath & inputPathPrefix)>
|
const InputPath & inputPathPrefix)>
|
||||||
updateLocks;
|
updateLocks;
|
||||||
|
|
||||||
|
std::vector<FlakeRef> parents;
|
||||||
|
|
||||||
updateLocks = [&](
|
updateLocks = [&](
|
||||||
const FlakeInputs & flakeInputs,
|
const FlakeInputs & flakeInputs,
|
||||||
const LockedInputs & oldLocks,
|
const LockedInputs & oldLocks,
|
||||||
|
@ -506,6 +509,14 @@ LockedFlake lockFlake(
|
||||||
flake. Also, unless we already have this
|
flake. Also, unless we already have this
|
||||||
flake in the top-level lock file, use this
|
flake in the top-level lock file, use this
|
||||||
flake's own lock file. */
|
flake's own lock file. */
|
||||||
|
|
||||||
|
/* Guard against circular flake imports. */
|
||||||
|
for (auto & parent : parents)
|
||||||
|
if (parent == input.ref)
|
||||||
|
throw Error("found circular import of flake '%s'", parent);
|
||||||
|
parents.push_back(input.ref);
|
||||||
|
Finally cleanup([&]() { parents.pop_back(); });
|
||||||
|
|
||||||
updateLocks(inputFlake.inputs,
|
updateLocks(inputFlake.inputs,
|
||||||
oldLock != oldLocks.inputs.end()
|
oldLock != oldLocks.inputs.end()
|
||||||
? (const LockedInputs &) oldLock->second
|
? (const LockedInputs &) oldLock->second
|
||||||
|
|
Loading…
Reference in a new issue