z-lua: wrap LUA_CPATH manually instead of lua.withPackages

We can't use lua.withPackages, because on darwin shebangs can't point to
interpreted (shebang'd) scripts. See https://github.com/NixOS/nixpkgs/issues/23018
This commit is contained in:
Mario Rodas 2019-09-21 04:20:00 -05:00
parent b16a186529
commit 0f1ce1787f
No known key found for this signature in database
GPG Key ID: 4C4BEFD7B18DC5E8

View File

@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, lua }:
{ stdenv, fetchFromGitHub, lua52Packages, makeWrapper }:
stdenv.mkDerivation rec {
pname = "z-lua";
@ -13,10 +13,17 @@ stdenv.mkDerivation rec {
dontBuild = true;
buildInputs = [ (lua.withPackages (p: with p; [ luafilesystem ])) ];
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ lua52Packages.lua ];
installPhase = ''
runHook preInstall
install -Dm755 z.lua $out/bin/z
wrapProgram $out/bin/z --set LUA_CPATH "${lua52Packages.luafilesystem}/lib/lua/5.2/lfs.so" --set _ZL_USE_LFS 1;
runHook postInstall
'';
meta = with stdenv.lib; {