Merge pull request #3137 from flosse/lua5-prefix-fix

use wrapper to set LUA_PATH variable to fix #3036
This commit is contained in:
Austin Seipp 2014-07-02 13:47:21 -05:00
commit d958fc4ea2

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;$HOME/.nix-profile/share/lua/5.1/?.lua"' \
--set LUA_CPATH '"$HOME/.nix-profile/lib/lua/5.1/?.so;$HOME/.nix-profile/share/lua/5.1/?.so"'
'';
meta = {