aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libexpr/flake/flake.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc
index 18b776727..9517e3645 100644
--- a/src/libexpr/flake/flake.cc
+++ b/src/libexpr/flake/flake.cc
@@ -314,6 +314,7 @@ LockedFlake lockFlake(
// FIXME: check whether all overrides are used.
std::map<InputPath, FlakeInput> overrides;
+ std::set<InputPath> overridesUsed, updatesUsed;
for (auto & i : lockFlags.inputOverrides)
overrides.insert_or_assign(i.first, FlakeInput { .ref = i.second });
@@ -363,6 +364,7 @@ LockedFlake lockFlake(
ancestors? */
auto i = overrides.find(inputPath);
bool hasOverride = i != overrides.end();
+ if (hasOverride) overridesUsed.insert(inputPath);
auto & input = hasOverride ? i->second : input2;
/* Resolve 'follows' later (since it may refer to an input
@@ -385,6 +387,8 @@ LockedFlake lockFlake(
don't have a --update-input flag for this input? */
std::shared_ptr<const LockedNode> oldLock;
+ updatesUsed.insert(inputPath);
+
if (oldNode && !lockFlags.inputUpdates.count(inputPath)) {
auto oldLockIt = oldNode->inputs.find(id);
if (oldLockIt != oldNode->inputs.end())
@@ -515,6 +519,15 @@ LockedFlake lockFlake(
fromParentNode->inputs.insert_or_assign(from.back(), toNode);
}
+ for (auto & i : lockFlags.inputOverrides)
+ if (!overridesUsed.count(i.first))
+ warn("the flag '--override-input %s %s' does not match any input",
+ concatStringsSep("/", i.first), i.second);
+
+ for (auto & i : lockFlags.inputUpdates)
+ if (!updatesUsed.count(i))
+ warn("the flag '--update-input %s' does not match any input", concatStringsSep("/", i));
+
debug("new lock file: %s", newLockFile);
/* Check whether we need to / can write the new lock file. */