{ stdenv, lua, fetchFromGitHub }:
stdenv.mkDerivation rec {
name = "cwrap-7";
src = fetchFromGitHub {
owner = "torch";
repo = "cwrap";
rev = "6e7d52f0a359dee47127386adb03c0dc4ddd4766";
sha256 = "01yh9z0axz0b4f87mbhkzh64dyv6c4jdkazcpmy1bl1am8apbd8w";
};
installPhase = ''
mkdir -p $out/share/lua/5.2/cwrap/ $out/nix-support
cp -v init.lua types.lua cinterface.lua $out/share/lua/5.2/cwrap/
cat <<EOF > $out/nix-support/setup-hook
# FIXME, overrides all other lua packages, doesnt persist past compile
export LUA_PATH=$out/share/lua/5.2/?/init.lua\;$out/share/lua/5.2/?.lua\;?.lua
EOF
'';
buildInputs = [ lua ];
}