Skip to content

Commit fd442d3

Browse files
committed
versionCheckHook: emit warning when falling back to pname
1 parent f7bc718 commit fd442d3

File tree

1 file changed

+5
-0
lines changed
  • pkgs/by-name/ve/versionCheckHook

1 file changed

+5
-0
lines changed

pkgs/by-name/ve/versionCheckHook/hook.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ versionCheckHook(){
4343
elif [[ ! -z "${NIX_MAIN_PROGRAM-}" ]]; then
4444
cmdProgram="${!outputBin}/bin/${NIX_MAIN_PROGRAM}"
4545
elif [[ ! -z "${pname-}" ]]; then
46+
echo "versionCheckHook: Package \`${pname}\` does not have the \`meta.mainProgram\` attribute." \
47+
"We'll assume that the main program has the same name for now, but this behavior is deprecated," \
48+
"because it leads to surprising errors when the assumption does not hold." \
49+
"If the package has a main program, please set \`meta.mainProgram\` in its definition to make this warning go away." \
50+
"Should the binary that outputs the intended version differ from \`meta.mainProgram\`, consider setting \`versionCheckProgram\` instead." >&2
4651
cmdProgram="${!outputBin}/bin/${pname}"
4752
else
4853
echo "versionCheckHook: \$versionCheckProgram, \$NIX_MAIN_PROGRAM and \$pname are all empty, so" \

0 commit comments

Comments
 (0)