use wrapper to set LUA_PATH variable

This commit is contained in:
Markus Kohlhase 2014-06-30 03:39:15 +02:00
parent 3ae3f3272f
commit 807cd4b4d4

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, readline }:
{ stdenv, fetchurl, readline, makeWrapper }:
let
dsoPatch = fetchurl {
@ -16,11 +16,11 @@ stdenv.mkDerivation rec {
sha256 = "2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333";
};
buildInputs = [ readline ];
buildInputs = [ readline makeWrapper ];
patches = if stdenv.isDarwin then [ ./5.1.darwin.patch ] else [ dsoPatch ];
configurePhase =
configurePhase =
if stdenv.isDarwin
then ''
makeFlagsArray=( INSTALL_TOP=$out INSTALL_MAN=$out/share/man/man1 PLAT=macosx CFLAGS="-DLUA_USE_LINUX -fno-common -O2" LDLAGS="" )
@ -35,6 +35,9 @@ stdenv.mkDerivation rec {
sed <"etc/lua.pc" >"$out/lib/pkgconfig/lua.pc" -e "s|^prefix=.*|prefix=$out|"
mv "doc/"*.{gif,png,css,html} "$out/share/doc/lua/"
rmdir $out/{share,lib}/lua/5.1 $out/{share,lib}/lua
wrapProgram $out/bin/lua \
--set LUA_PATH '$HOME/.nix-profile/lib/lua/5.1/?.lua' \
--set LUA_CPATH '$HOME/.nix-profile/lib/lua/5.1/?.so'
'';
meta = {