at release-16.03-start 433 lines 13 kB view raw
1/* This file defines the composition for Lua packages. It has 2 been factored out of all-packages.nix because there are many of 3 them. Also, because most Nix expressions for Lua packages are 4 trivial, most are actually defined here. I.e. there's no function 5 for each package in a separate file: the call to the function would 6 be almost as must code as the function itself. */ 7 8{ fetchurl, fetchzip, stdenv, lua, callPackage, unzip, zziplib, pkgconfig, libtool 9, pcre, oniguruma, gnulib, tre, glibc, sqlite, openssl, expat, cairo 10, perl, gtk, python, glib, gobjectIntrospection, libevent, zlib, autoreconfHook 11, fetchFromGitHub 12}: 13 14let 15 isLua51 = lua.luaversion == "5.1"; 16 isLua52 = lua.luaversion == "5.2"; 17 self = _self; 18 _self = with self; { 19 inherit lua; 20 inherit (stdenv.lib) maintainers; 21 22 #define build lua package function 23 buildLuaPackage = callPackage ../development/lua-modules/generic lua; 24 25 luarocks = callPackage ../development/tools/misc/luarocks { 26 inherit lua; 27 }; 28 29 luabitop = buildLuaPackage rec { 30 version = "1.0.2"; 31 name = "bitop-${version}"; 32 src = fetchurl { 33 url = "http://bitop.luajit.org/download/LuaBitOp-${version}.tar.gz"; 34 sha256 = "16fffbrgfcw40kskh2bn9q7m3gajffwd2f35rafynlnd7llwj1qj"; 35 }; 36 37 buildFlags = stdenv.lib.optionalString stdenv.isDarwin "macosx"; 38 39 postPatch = stdenv.lib.optionalString stdenv.isDarwin '' 40 substituteInPlace Makefile --replace 10.4 10.5 41 ''; 42 43 preBuild = '' 44 makeFlagsArray=( 45 ${stdenv.lib.optionalString stdenv.cc.isClang "CC=$CC"} 46 INCLUDES="-I${lua}/include" 47 LUA="${lua}/bin/lua"); 48 ''; 49 50 installPhase = '' 51 mkdir -p $out/lib/lua/${lua.luaversion} 52 install -p bit.so $out/lib/lua/${lua.luaversion} 53 ''; 54 55 meta = { 56 homepage = "http://bitop.luajit.org"; 57 maintainers = with maintainers; [ flosse ]; 58 }; 59 }; 60 61 luaevent = buildLuaPackage rec { 62 version = "0.4.3"; 63 name = "luaevent-${version}"; 64 disabled = isLua52; 65 66 src = fetchzip { 67 url = "https://github.com/harningt/luaevent/archive/v${version}.tar.gz"; 68 sha256 = "1c1n2zqx5rwfwkqaq1jj8gvx1vswvbihj2sy445w28icz1xfhpik"; 69 }; 70 71 preBuild = '' 72 makeFlagsArray=( 73 INSTALL_DIR_LUA="$out/share/lua/${lua.luaversion}" 74 INSTALL_DIR_BIN="$out/lib/lua/${lua.luaversion}" 75 LUA_INC_DIR="${lua}/include" 76 ); 77 ''; 78 79 buildInputs = [ libevent ]; 80 81 propagatedBuildInputs = [ luasocket ]; 82 83 meta = with stdenv.lib; { 84 homepage = http://luaforge.net/projects/luaevent/; 85 description = "Binding of libevent to Lua"; 86 license = licenses.mit; 87 maintainers = [ maintainers.koral ]; 88 }; 89 }; 90 91 luaexpat = buildLuaPackage rec { 92 version = "1.3.0"; 93 name = "expat-${version}"; 94 isLibrary = true; 95 src = fetchurl { 96 url = "https://matthewwild.co.uk/projects/luaexpat/luaexpat-${version}.tar.gz"; 97 sha256 = "1hvxqngn0wf5642i5p3vcyhg3pmp102k63s9ry4jqyyqc1wkjq6h"; 98 }; 99 100 buildInputs = [ expat ]; 101 102 preBuild = '' 103 makeFlagsArray=( 104 LUA_LDIR="$out/share/lua/${lua.luaversion}" 105 LUA_INC="-I${lua}/include" LUA_CDIR="$out/lib/lua/${lua.luaversion}" 106 EXPAT_INC="-I${expat}/include"); 107 ''; 108 109 meta = { 110 homepage = "http://matthewwild.co.uk/projects/luaexpat"; 111 hydraPlatforms = stdenv.lib.platforms.linux; 112 maintainers = [ stdenv.lib.maintainers.flosse ]; 113 }; 114 }; 115 116 luafilesystem = buildLuaPackage rec { 117 name = "filesystem-1.6.2"; 118 src = fetchzip { 119 url = "https://github.com/keplerproject/luafilesystem/archive/v1_6_2.tar.gz"; 120 sha256 = "134azkxw84xp9g5qmzjsmcva629jm7plwcmjxkdzdg05vyd7kig1"; 121 }; 122 meta = { 123 homepage = "https://github.com/keplerproject/luafilesystem"; 124 hydraPlatforms = stdenv.lib.platforms.linux; 125 maintainers = with maintainers; [ flosse ]; 126 }; 127 }; 128 129 lpty = buildLuaPackage rec { 130 name = "lpty-${version}"; 131 version = "1.1.1"; 132 src = fetchurl { 133 url = "http://www.tset.de/downloads/lpty-1.1-1.tar.gz"; 134 sha256 = "0d4ffda654dcf37dd8c99bcd100d0ee0dde7782cbd0ba9200ef8711c5cab02f1"; 135 }; 136 meta = { 137 homepage = "http://www.tset.de/lpty"; 138 hydraPlatforms = stdenv.lib.platforms.linux; 139 license = stdenv.lib.licenses.mit; 140 }; 141 preBuild = '' 142 makeFlagsArray=( 143 INST_LIBDIR="$out/lib/lua/${lua.luaversion}" 144 INST_LUADIR="$out/share/lua/${lua.luaversion}" 145 LUA_BINDIR="${lua}/bin" 146 LUA_INCDIR="-I${lua}/include" 147 LUA_LIBDIR="-L${lua}/lib" 148 ); 149 ''; 150 }; 151 152 luasec = buildLuaPackage rec { 153 name = "sec-0.6pre-2015-04-17"; 154 src = fetchFromGitHub { 155 owner = "brunoos"; 156 repo = "luasec"; 157 rev = "12e1b1f1d9724974ecc6ca273a0661496d96b3e7"; 158 sha256 = "0m917qgi54p6n2ak33m67q8sxcw3cdni99bm216phjjka9rg7qwd"; 159 }; 160 161 buildInputs = [ openssl ]; 162 163 preBuild = '' 164 makeFlagsArray=( 165 linux 166 LUAPATH="$out/lib/lua/${lua.luaversion}" 167 LUACPATH="$out/lib/lua/${lua.luaversion}" 168 INC_PATH="-I${lua}/include" 169 LIB_PATH="-L$out/lib"); 170 ''; 171 172 meta = { 173 homepage = "https://github.com/brunoos/luasec"; 174 hydraPlatforms = stdenv.lib.platforms.linux; 175 maintainers = [ stdenv.lib.maintainers.flosse ]; 176 }; 177 }; 178 179 luasocket = buildLuaPackage rec { 180 name = "socket-${version}"; 181 version = "3.0-rc1"; 182 src = fetchurl { 183 url = "https://github.com/diegonehab/luasocket/archive/v${version}.tar.gz"; 184 sha256 = "0j8jx8bjicvp9khs26xjya8c495wrpb7parxfnabdqa5nnsxjrwb"; 185 }; 186 187 patchPhase = '' 188 sed -e "s,^LUAPREFIX_linux.*,LUAPREFIX_linux=$out," \ 189 -i src/makefile 190 ''; 191 192 meta = { 193 homepage = "http://w3.impa.br/~diego/software/luasocket/"; 194 hydraPlatforms = stdenv.lib.platforms.linux; 195 maintainers = with maintainers; [ mornfall ]; 196 }; 197 }; 198 199 luazip = buildLuaPackage rec { 200 name = "zip-${version}"; 201 version = "1.2.3"; 202 src = fetchzip { 203 url = "https://github.com/luaforge/luazip/archive/0b8f5c958e170b1b49f05bc267bc0351ad4dfc44.zip"; 204 sha256 = "0zrrwhmzny5zbpx91bjbl77gzkvvdi3qhhviliggp0aj8w3faxsr"; 205 }; 206 buildInputs = [ unzip zziplib ]; 207 patches = [ ../development/lua-modules/zip.patch ]; 208 # does not currently work under lua 5.2 209 disabled = isLua52; 210 meta = { 211 homepage = "https://github.com/luaforge/luazip"; 212 hydraPlatforms = stdenv.lib.platforms.linux; 213 license = stdenv.lib.licenses.mit; 214 }; 215 }; 216 217 luazlib = buildLuaPackage rec { 218 name = "zlib-${version}"; 219 version = "0.4"; 220 221 src = fetchzip { 222 url = "https://github.com/brimworks/lua-zlib/archive/v${version}.tar.gz"; 223 sha256 = "1pgxnjc0gvk25wsr69nsm60y5ad86z1nlq7mzj3ckygzkgi782dd"; 224 }; 225 226 buildInputs = [ zlib ]; 227 228 preBuild = '' 229 makeFlagsArray=( 230 linux 231 LUAPATH="$out/share/lua/${lua.luaversion}" 232 LUACPATH="$out/lib/lua/${lua.luaversion}" 233 INCDIR="-I${lua}/include" 234 LIBDIR="-L$out/lib"); 235 ''; 236 237 preInstall = "mkdir -p $out/lib/lua/${lua.luaversion}"; 238 239 meta = with stdenv.lib; { 240 homepage = https://github.com/brimworks/lua-zlib; 241 hydraPlatforms = platforms.linux; 242 license = licenses.mit; 243 maintainers = [ maintainers.koral ]; 244 }; 245 }; 246 247 248 luastdlib = buildLuaPackage { 249 name = "stdlib"; 250 src = fetchzip { 251 url = "https://github.com/lua-stdlib/lua-stdlib/archive/release.zip"; 252 sha256 = "0636absdfjx8ybglwydmqxwfwmqz1c4b9s5mhxlgm4ci18lw3hms"; 253 }; 254 buildInputs = [ autoreconfHook unzip ]; 255 meta = { 256 homepage = "https://github.com/lua-stdlib/lua-stdlib/"; 257 hydraPlatforms = stdenv.lib.platforms.linux; 258 license = stdenv.lib.licenses.mit; 259 }; 260 }; 261 262 lrexlib = buildLuaPackage rec { 263 name = "lrexlib-${version}"; 264 version = "2.7.2"; 265 src = fetchzip { 266 url = "https://github.com/rrthomas/lrexlib/archive/150c251be57c4e569da0f48bf6b01fbca97179fe.zip"; 267 sha256 = "0acb3258681bjq61piz331r99bdff6cnkjaigq5phg3699iz5h75"; 268 }; 269 buildInputs = [ unzip luastdlib pcre luarocks oniguruma gnulib tre glibc ]; 270 271 buildPhase = let 272 luaVariable = "LUA_PATH=${luastdlib}/share/lua/${lua.luaversion}/?.lua"; 273 274 pcreVariable = "PCRE_DIR=${pcre}"; 275 onigVariable = "ONIG_DIR=${oniguruma}"; 276 gnuVariable = "GNU_INCDIR=${gnulib}/lib"; 277 treVariable = "TRE_DIR=${tre}"; 278 posixVariable = "POSIX_DIR=${glibc}"; 279 in '' 280 sed -e 's@$(LUAROCKS) $(LUAROCKS_COMMAND) $$i;@$(LUAROCKS) $(LUAROCKS_COMMAND) $$i ${pcreVariable} ${onigVariable} ${gnuVariable} ${treVariable} ${posixVariable};@' \ 281 -i Makefile 282 ${luaVariable} make 283 ''; 284 285 installPhase = '' 286 mkdir -pv $out; 287 cp -r luarocks/lib $out; 288 ''; 289 290 meta = { 291 homepage = "https://github.com/lua-stdlib/lua-stdlib/"; 292 hydraPlatforms = stdenv.lib.platforms.linux; 293 license = stdenv.lib.licenses.mit; 294 broken = true; 295 }; 296 }; 297 298 luasqlite3 = buildLuaPackage rec { 299 name = "sqlite3-${version}"; 300 version = "2.1.1"; 301 src = fetchzip { 302 url = "https://github.com/LuaDist/luasql-sqlite3/archive/2acdb6cb256e63e5b5a0ddd72c4639d8c0feb52d.zip"; 303 sha256 = "17zsa0jzciildil9k4lb0rjn9s1nj80dy16pzx9bxqyi75pjf2d4"; 304 }; 305 306 buildInputs = [ unzip sqlite ]; 307 308 patches = [ ../development/lua-modules/luasql.patch ]; 309 310 meta = { 311 homepage = "https://github.com/LuaDist/luasql-sqlite3"; 312 hydraPlatforms = stdenv.lib.platforms.linux; 313 license = stdenv.lib.licenses.mit; 314 }; 315 }; 316 317 lpeg = buildLuaPackage rec { 318 name = "lpeg-${version}"; 319 version = "0.12"; 320 src = fetchurl { 321 url = "http://www.inf.puc-rio.br/~roberto/lpeg/${name}.tar.gz"; 322 sha256 = "0xlbfw1w7l65a5qhnx5sfw327hkq1zcj8xmg4glfw6fj9ha4b9gg"; 323 }; 324 buildInputs = [ unzip ]; 325 326 preBuild = '' 327 makeFlagsArray=(CC=$CC); 328 ''; 329 330 buildFlags = if stdenv.isDarwin then "macosx" else ""; 331 332 installPhase = '' 333 mkdir -p $out/lib/lua/${lua.luaversion} 334 install -p lpeg.so $out/lib/lua/${lua.luaversion} 335 install -p re.lua $out/lib/lua/${lua.luaversion} 336 ''; 337 338 meta = { 339 homepage = "http://www.inf.puc-rio.br/~roberto/lpeg/"; 340 hydraPlatforms = stdenv.lib.platforms.all; 341 license = stdenv.lib.licenses.mit; 342 }; 343 }; 344 345 cjson = buildLuaPackage rec { 346 name = "cjson-${version}"; 347 version = "2.1.0"; 348 src = fetchurl { 349 url = "http://www.kyne.com.au/~mark/software/download/lua-cjson-2.1.0.tar.gz"; 350 sha256 = "0y67yqlsivbhshg8ma535llz90r4zag9xqza5jx0q7lkap6nkg2i"; 351 }; 352 preBuild = '' 353 sed -i "s|/usr/local|$out|" Makefile 354 ''; 355 makeFlags = [ "LUA_VERSION=${lua.luaversion}" ]; 356 postInstall = '' 357 rm -rf $out/share/lua/${lua.luaversion}/cjson/tests 358 ''; 359 installTargets = "install install-extra"; 360 meta = { 361 description = "Lua C extension module for JSON support"; 362 license = stdenv.lib.licenses.mit; 363 }; 364 }; 365 366 luaMessagePack = buildLuaPackage rec { 367 name = "lua-MessagePack-${version}"; 368 version = "0.3.1"; 369 src = fetchzip { 370 url = "https://github.com/fperrad/lua-MessagePack/archive/${version}.tar.gz"; 371 sha256 = "1xlif8fkwd8bb78wrvf2z309p7apms350lbg6qavylsvz57lkjm6"; 372 }; 373 buildInputs = [ unzip ]; 374 375 meta = { 376 homepage = "http://fperrad.github.io/lua-MessagePack/index.html"; 377 hydraPlatforms = stdenv.lib.platforms.linux; 378 license = stdenv.lib.licenses.mit; 379 }; 380 }; 381 382 lgi = stdenv.mkDerivation rec { 383 name = "lgi-${version}"; 384 version = "0.7.2"; 385 386 src = fetchzip { 387 url = "https://github.com/pavouk/lgi/archive/${version}.tar.gz"; 388 sha256 = "10i2ssfs01d49fdmmriqzxc8pshys4rixhx30wzd9p1m1q47a5pn"; 389 }; 390 391 meta = with stdenv.lib; { 392 description = "GObject-introspection based dynamic Lua binding to GObject based libraries"; 393 homepage = https://github.com/pavouk/lgi; 394 license = "custom"; 395 maintainers = with maintainers; [ lovek323 ]; 396 platforms = platforms.unix; 397 }; 398 399 buildInputs = [ glib gobjectIntrospection lua pkgconfig ]; 400 401 makeFlags = [ "LUA_VERSION=${lua.luaversion}" ]; 402 403 preBuild = '' 404 sed -i "s|/usr/local|$out|" lgi/Makefile 405 ''; 406 }; 407 408 vicious = stdenv.mkDerivation rec { 409 name = "vicious-${version}"; 410 version = "2.1.3"; 411 412 src = fetchzip { 413 url = "http://git.sysphere.org/vicious/snapshot/vicious-${version}.tar.xz"; 414 sha256 = "1c901siza5vpcbkgx99g1vkqiki5qgkzx2brnj4wrpbsbfzq0bcq"; 415 }; 416 417 meta = with stdenv.lib; { 418 description = "vicious widgets for window managers"; 419 homepage = http://git.sysphere.org/vicious/; 420 license = licenses.gpl2; 421 maintainers = with maintainers; [ makefu ]; 422 platforms = platforms.linux; 423 }; 424 425 buildInputs = [ lua ]; 426 installPhase = '' 427 mkdir -p $out/lib/lua/${lua.luaversion}/ 428 cp -r . $out/lib/lua/${lua.luaversion}/vicious/ 429 printf "package.path = '$out/lib/lua/${lua.luaversion}/?/init.lua;' .. package.path\nreturn require((...) .. '.init')\n" > $out/lib/lua/${lua.luaversion}/vicious.lua 430 ''; 431 }; 432 433}; in self