@@ -1,81 +0,0 @@
1−{lib, stdenv, fetchFromGitHub
2−, curl, makeWrapper, which, unzip
3−, lua
4−# for 'luarocks pack'
5−, zip
6−# some packages need to be compiled with cmake
7−, cmake
8−, installShellFiles
9−}:
10−
11−stdenv.mkDerivation rec {
12− pname = "luarocks";
13− version = "3.7.0";
14−
15− src = fetchFromGitHub {
16− owner = "luarocks";
17− repo = "luarocks";
18− rev = "v${version}";
19− sha256 = "1sn2j7hv8nbdjqj1747glk9770zw8q5v8ivaxhvwbk3vl038ck9d";
20− };
21−
22− patches = [ ./darwin-3.7.0.patch ];
23−
24− postPatch = lib.optionalString stdenv.targetPlatform.isDarwin ''
25− substituteInPlace src/luarocks/core/cfg.lua --subst-var-by 'darwinMinVersion' '${stdenv.targetPlatform.darwinMinVersion}'
26− '';
27−
28− preConfigure = ''
29− lua -e "" || {
30− luajit -e "" && {
31− export LUA_SUFFIX=jit
32− configureFlags="$configureFlags --lua-suffix=$LUA_SUFFIX"
33− }
34− }
35− lua_inc="$(echo "${lua}/include"/*/)"
36− if test -n "$lua_inc"; then
37− configureFlags="$configureFlags --with-lua-include=$lua_inc"
38− fi
39− '';
40−
41− nativeBuildInputs = [ makeWrapper installShellFiles ];
42−
43− buildInputs = [ lua curl which ];
44−
45− postInstall = ''
46− sed -e "1s@.*@#! ${lua}/bin/lua$LUA_SUFFIX@" -i "$out"/bin/*
47− for i in "$out"/bin/*; do
48− test -L "$i" || {
49− wrapProgram "$i" \
50− --suffix LUA_PATH ";" "$(echo "$out"/share/lua/*/)?.lua" \
51− --suffix LUA_PATH ";" "$(echo "$out"/share/lua/*/)?/init.lua" \
52− --suffix LUA_CPATH ";" "$(echo "$out"/lib/lua/*/)?.so" \
53− --suffix LUA_CPATH ";" "$(echo "$out"/share/lua/*/)?/init.lua"
54− }
55− done
56−
57− installShellCompletion --cmd luarocks --bash <($out/bin/luarocks completion bash)
58− installShellCompletion --cmd luarocks --zsh <($out/bin/luarocks completion zsh)
59− '';
60−
61− propagatedBuildInputs = [ zip unzip cmake ];
62−
63− # unpack hook for src.rock and rockspec files
64− setupHook = ./setup-hook.sh;
65−
66− # cmake is just to compile packages with "cmake" buildType, not luarocks itself
67− dontUseCmakeConfigure = true;
68−
69− shellHook = ''
70− export PATH="src/bin:''${PATH:-}"
71− export LUA_PATH="src/?.lua;''${LUA_PATH:-}"
72− '';
73−
74− meta = with lib; {
75− description = "A package manager for Lua";
76− license = licenses.mit ;
77− maintainers = with maintainers; [raskin teto];
78− platforms = platforms.linux ++ platforms.darwin;
79− downloadPage = "http://luarocks.org/releases/";
80− };
81−}