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