From 8da8c805bb7a4f4080f04b6b01c7ac1bece1a23b Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Thu, 14 Aug 2014 10:14:12 +0400 Subject: [PATCH] Update luarocks --- .../tools/misc/luarocks/default.nix | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/pkgs/development/tools/misc/luarocks/default.nix b/pkgs/development/tools/misc/luarocks/default.nix index c8579ef3831b..4a38762a3ff3 100644 --- a/pkgs/development/tools/misc/luarocks/default.nix +++ b/pkgs/development/tools/misc/luarocks/default.nix @@ -1,16 +1,16 @@ -{stdenv, fetchurl, lua, curl}: +{stdenv, fetchurl, lua, curl, makeWrapper, which}: let s = # Generated upstream information rec { baseName="luarocks"; - version="2.2"; + version="2.2.0"; name="${baseName}-${version}"; - hash="03i46ayimp087288f0bi6g30fi3aixp2bha2jmsbbhwmsxm1yshs"; - url="http://luarocks.org/releases/luarocks-2.2.0beta1.tar.gz"; - sha256="03i46ayimp087288f0bi6g30fi3aixp2bha2jmsbbhwmsxm1yshs"; + hash="1717p694455w1fdldb2ldlyklln8w3bqk1dsly8gpqh3n73lw6lv"; + url="http://luarocks.org/releases/luarocks-2.2.0-rc1.tar.gz"; + sha256="1717p694455w1fdldb2ldlyklln8w3bqk1dsly8gpqh3n73lw6lv"; }; buildInputs = [ - lua curl + lua curl makeWrapper which ]; in stdenv.mkDerivation { @@ -19,6 +19,29 @@ stdenv.mkDerivation { src = fetchurl { inherit (s) url sha256; }; + preConfigure = '' + lua -e "" || { + luajit -e "" && { + export LUA_SUFFIX=jit + configureFlags="$configureFlags --lua-suffix=$LUA_SUFFIX" + } + } + lua_inc="$(echo "${lua}/include"/*/)" + if test -n "$lua_inc"; then + configureFlags="$configureFlags --with-lua-include=$lua_inc" + fi + ''; + postInstall = '' + sed -e "1s@.*@#! ${lua}/bin/lua$LUA_SUFFIX@" -i "$out"/bin/* + for i in "$out"/bin/*; do + test -L "$i" || { + wrapProgram "$i" \ + --prefix LUA_PATH ";" "$(echo "$out"/share/lua/*/)?.lua" \ + --prefix LUA_PATH ";" "$(echo "$out"/share/lua/*/)?/init.lua" \ + + } + done + ''; meta = { inherit (s) version; description = ''A package manager for Lua'';