validate-flake-strict-inputs fails on flakes with only path/follows inputs
Summary
The validate-flake-inputs bash script in flake-strict-inputs.nix fails when a flake has no git or github type direct inputs (e.g., all inputs are path: references or follows declarations).
Root Cause
The jq filter correctly returns empty output when no git/github inputs exist. However, the bash while IFS='|' read -r name ref url; do ... done <<< "$all_inputs" construct still executes once when $all_inputs is empty, because <<< with an empty string passes a single empty line to read.
This causes the validator to check an empty name and empty ref, producing:
✗ : (not in allowed prefixes: refs/tags/ refs/heads/lts/ ...)
Reproduction
Any test flake with only path: and follows inputs triggers this:
{
inputs = {
some-lib.url = "path:../../../../..";
nixpkgs.follows = "some-lib/nixpkgs";
};
# ...
}
The flake.lock has no git/github typed nodes among direct inputs, so the jq filter returns nothing, and the empty-string-through-heredoc bug fires.
Fix
Add an empty check before the while loop in makeValidator:
if [[ -z "$all_inputs" ]]; then
echo " No git/github inputs to validate."
echo ""
echo "✅ All direct flake inputs are valid!"
exit 0
fi
Context
Found while setting up child test pipelines in nix/haskell-make-package-set (MR !3 (merged)). Test flakes reference the parent via path: and use follows for transitive deps, leaving zero git/github inputs for the validator to check.