diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libexpr/flake/flake.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc index 920726b73..906e11251 100644 --- a/src/libexpr/flake/flake.cc +++ b/src/libexpr/flake/flake.cc @@ -353,6 +353,39 @@ LockedFlake lockFlake( std::vector<FlakeRef> parents; std::function<void( + const InputPath & inputPathPrefix, + const FlakeInputs & flakeInputs + )> + checkFollowsDeclarations; + + checkFollowsDeclarations = [&]( + const InputPath & inputPathPrefix, + const FlakeInputs & flakeInputs + ) { + for (auto [inputPath, inputOverride] : overrides) { + auto inputPath2(inputPath); + auto follow = inputPath2.back(); + inputPath2.pop_back(); + if (inputPath2 == inputPathPrefix + && flakeInputs.find(follow) == flakeInputs.end() + ) { + std::string root; + for (auto & element : inputPath2) { + root.append(element); + if (element != inputPath2.back()) { + root.append(".inputs."); + } + } + warn( + "%s has a `follows'-declaration for a non-existant input %s!", + root, + follow + ); + } + } + }; + + std::function<void( const FlakeInputs & flakeInputs, std::shared_ptr<Node> node, const InputPath & inputPathPrefix, @@ -373,6 +406,8 @@ LockedFlake lockFlake( { debug("computing lock file node '%s'", printInputPath(inputPathPrefix)); + checkFollowsDeclarations(inputPathPrefix, flakeInputs); + /* Get the overrides (i.e. attributes of the form 'inputs.nixops.inputs.nixpkgs.url = ...'). */ for (auto & [id, input] : flakeInputs) { |