at 22.05-pre 139 lines 4.2 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, stdenv, lua, unzip, pkg-config 9, pcre, oniguruma, gnulib, tre, glibc, sqlite, openssl, expat 10, autoreconfHook, gnum4 11, postgresql, cyrus_sasl 12, fetchFromGitHub, which, writeText 13, pkgs 14, lib 15}@args: 16 17let 18 packages = ( self: 19 20let 21 callPackage = pkgs.newScope self; 22 23 buildLuaApplication = args: buildLuarocksPackage ({namePrefix="";} // args ); 24 25 buildLuarocksPackage = lib.makeOverridable(callPackage ../development/interpreters/lua-5/build-lua-package.nix { 26 inherit lua; 27 inherit (pkgs) lib; 28 inherit (luaLib) toLuaModule; 29 }); 30 31 luaLib = import ../development/lua-modules/lib.nix { 32 inherit (pkgs) lib; 33 inherit pkgs lua; 34 }; 35 36 #define build lua package function 37 buildLuaPackage = callPackage ../development/lua-modules/generic { 38 inherit writeText; 39 }; 40 41 getPath = drv: pathListForVersion: 42 lib.concatMapStringsSep ";" (path: "${drv}/${path}") pathListForVersion; 43 44in 45{ 46 # helper functions for dealing with LUA_PATH and LUA_CPATH 47 lib = luaLib; 48 49 getLuaPath = drv: getPath drv luaLib.luaPathList; 50 getLuaCPath = drv: getPath drv luaLib.luaCPathList; 51 52 inherit (callPackage ../development/interpreters/lua-5/hooks { inherit (args) lib;}) 53 lua-setup-hook; 54 55 inherit lua callPackage; 56 inherit buildLuaPackage buildLuarocksPackage buildLuaApplication; 57 inherit (luaLib) luaOlder luaAtLeast isLua51 isLua52 isLua53 isLuaJIT 58 requiredLuaModules toLuaModule hasLuaModule; 59 60 # wraps programs in $out/bin with valid LUA_PATH/LUA_CPATH 61 wrapLua = callPackage ../development/interpreters/lua-5/wrap-lua.nix { 62 inherit lua lib; 63 inherit (pkgs) makeSetupHook makeWrapper; 64 }; 65 66 luarocks = callPackage ../development/tools/misc/luarocks { 67 inherit lua lib; 68 }; 69 70 luarocks-3_7 = callPackage ../development/tools/misc/luarocks/3.7.nix { 71 inherit lua lib; 72 }; 73 74 # a fork of luarocks used to generate nix lua derivations from rockspecs 75 luarocks-nix = callPackage ../development/tools/misc/luarocks/luarocks-nix.nix { }; 76 77 luxio = buildLuaPackage { 78 pname = "luxio"; 79 version = "13"; 80 81 src = fetchurl { 82 url = "https://git.gitano.org.uk/luxio.git/snapshot/luxio-luxio-13.tar.bz2"; 83 sha256 = "1hvwslc25q7k82rxk461zr1a2041nxg7sn3sw3w0y5jxf0giz2pz"; 84 }; 85 86 nativeBuildInputs = [ which pkg-config ]; 87 88 postPatch = '' 89 patchShebangs . 90 ''; 91 92 preBuild = '' 93 makeFlagsArray=( 94 INST_LIBDIR="$out/lib/lua/${lua.luaversion}" 95 INST_LUADIR="$out/share/lua/${lua.luaversion}" 96 LUA_BINDIR="$out/bin" 97 INSTALL=install 98 ); 99 ''; 100 101 meta = with lib; { 102 description = "Lightweight UNIX I/O and POSIX binding for Lua"; 103 homepage = "https://www.gitano.org.uk/luxio/"; 104 license = licenses.mit; 105 maintainers = with maintainers; [ richardipsum ]; 106 platforms = platforms.unix; 107 }; 108 }; 109 110 vicious = luaLib.toLuaModule( stdenv.mkDerivation rec { 111 pname = "vicious"; 112 version = "2.5.0"; 113 114 src = fetchFromGitHub { 115 owner = "Mic92"; 116 repo = "vicious"; 117 rev = "v${version}"; 118 sha256 = "0lb90334mz0my8ydsmnsnkki0xr58kinsg0hf9d6k4b0vjfi0r0a"; 119 }; 120 121 buildInputs = [ lua ]; 122 123 installPhase = '' 124 mkdir -p $out/lib/lua/${lua.luaversion}/ 125 cp -r . $out/lib/lua/${lua.luaversion}/vicious/ 126 printf "package.path = '$out/lib/lua/${lua.luaversion}/?/init.lua;' .. package.path\nreturn require((...) .. '.init')\n" > $out/lib/lua/${lua.luaversion}/vicious.lua 127 ''; 128 129 meta = with lib; { 130 description = "A modular widget library for the awesome window manager"; 131 homepage = "https://github.com/Mic92/vicious"; 132 license = licenses.gpl2; 133 maintainers = with maintainers; [ makefu mic92 ]; 134 platforms = platforms.linux; 135 }; 136 }); 137 138}); 139in packages