versionCheckHook: emit warning when falling back to pname

This commit is contained in:
Benjamin Sparks
2025-06-15 19:05:44 +02:00
parent 651abd9307
commit 32a6fb65a1
+5
View File
@@ -43,6 +43,11 @@ versionCheckHook(){
elif [[ ! -z "${NIX_MAIN_PROGRAM-}" ]]; then
cmdProgram="${!outputBin}/bin/${NIX_MAIN_PROGRAM}"
elif [[ ! -z "${pname-}" ]]; then
echo "versionCheckHook: Package \`${pname}\` does not have the \`meta.mainProgram\` attribute." \
"We'll assume that the main program has the same name for now, but this behavior is deprecated," \
"because it leads to surprising errors when the assumption does not hold." \
"If the package has a main program, please set \`meta.mainProgram\` in its definition to make this warning go away." \
"Should the binary that outputs the intended version differ from \`meta.mainProgram\`, consider setting \`versionCheckProgram\` instead." >&2
cmdProgram="${!outputBin}/bin/${pname}"
else
echo "versionCheckHook: \$NIX_MAIN_PROGRAM, \$versionCheckProgram and \$pname are all empty, so" \