stylelint-lsp: fix script launch issue on macOS

A leading space before the shebang doesn't affect script execution when run from the shell or via exec on Linux.
However, on macOS, it results in an ENOEXEC (File format error) when using exec.
This fix removes the space to ensure stylelint-lsp can be launched from nixvim on macOS without errors.

Thanks to @gepbird for suggesting the proper fix.
This commit is contained in:
Alexey Naidyonov 2024-10-16 21:30:45 +02:00
parent 6ced9c6711
commit dc55dab2ae
No known key found for this signature in database
GPG Key ID: 93B6567E31EBC9C1

View File

@ -1,5 +1,4 @@
{
bash,
fetchFromGitHub,
lib,
nodejs,
@ -18,8 +17,11 @@ stdenvNoCC.mkDerivation (finalAttrs: {
hash = "sha256-mzhY6MKkXb1jFYZvs/VkGipBjBfUY3GukICb9qVQI80=";
};
nativeBuildInputs = [
buildInputs = [
nodejs
];
nativeBuildInputs = [
pnpm_9.configHook
];
@ -41,11 +43,8 @@ stdenvNoCC.mkDerivation (finalAttrs: {
mkdir -p $out/{bin,lib/${finalAttrs.pname}}
mv {dist,node_modules} $out/lib/${finalAttrs.pname}
echo "
#!${lib.getExe bash}
${lib.getExe nodejs} $out/lib/${finalAttrs.pname}/dist/index.js \$@
" > $out/bin/stylelint-lsp
chmod +x $out/bin/stylelint-lsp
chmod a+x $out/lib/${finalAttrs.pname}/dist/index.js
ln -s $out/lib/${finalAttrs.pname}/dist/index.js $out/bin/stylelint-lsp
runHook postInstall
'';