at 23.11-beta 169 lines 5.4 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{ pkgs 9, stdenv 10, lib 11, lua 12}: 13 14 15self: 16 17let 18 inherit (self) callPackage; 19 20 buildLuaApplication = args: buildLuarocksPackage ({ namePrefix = ""; } // args); 21 22 buildLuarocksPackage = lib.makeOverridable (callPackage ../development/interpreters/lua-5/build-luarocks-package.nix { }); 23 24 luaLib = callPackage ../development/lua-modules/lib.nix { }; 25 26 #define build lua package function 27 buildLuaPackage = callPackage ../development/lua-modules/generic { }; 28 29 getPath = drv: pathListForVersion: 30 lib.concatMapStringsSep ";" (path: "${drv}/${path}") pathListForVersion; 31 32in 33rec { 34 35 # Dont take luaPackages from "global" pkgs scope to avoid mixing lua versions 36 luaPackages = self; 37 38 # helper functions for dealing with LUA_PATH and LUA_CPATH 39 inherit luaLib; 40 41 getLuaPath = drv: getPath drv luaLib.luaPathList; 42 getLuaCPath = drv: getPath drv luaLib.luaCPathList; 43 44 inherit (callPackage ../development/interpreters/lua-5/hooks { }) 45 luarocksMoveDataFolder luarocksCheckHook lua-setup-hook; 46 47 inherit lua; 48 inherit buildLuaPackage buildLuarocksPackage buildLuaApplication; 49 inherit (luaLib) luaOlder luaAtLeast isLua51 isLua52 isLua53 isLuaJIT 50 requiredLuaModules toLuaModule hasLuaModule; 51 52 # wraps programs in $out/bin with valid LUA_PATH/LUA_CPATH 53 wrapLua = callPackage ../development/interpreters/lua-5/wrap-lua.nix { 54 inherit (pkgs.buildPackages) makeSetupHook makeWrapper; 55 }; 56 57 luarocks = toLuaModule (callPackage ../development/tools/misc/luarocks/default.nix { }); 58 59 # a fork of luarocks used to generate nix lua derivations from rockspecs 60 luarocks-nix = toLuaModule (callPackage ../development/tools/misc/luarocks/luarocks-nix.nix { }); 61 62 lua-resty-core = callPackage ({ fetchFromGitHub }: buildLuaPackage rec { 63 pname = "lua-resty-core"; 64 version = "0.1.24"; 65 66 src = fetchFromGitHub { 67 owner = "openresty"; 68 repo = "lua-resty-core"; 69 rev = "v${version}"; 70 sha256 = "sha256-obwyxHSot1Lb2c1dNqJor3inPou+UIBrqldbkNBCQQk="; 71 }; 72 73 propagatedBuildInputs = [ lua-resty-lrucache ]; 74 75 meta = with lib; { 76 description = "New FFI-based API for lua-nginx-module"; 77 homepage = "https://github.com/openresty/lua-resty-core"; 78 license = licenses.bsd3; 79 maintainers = with maintainers; [ ]; 80 }; 81 }) {}; 82 83 lua-resty-lrucache = callPackage ({ fetchFromGitHub }: buildLuaPackage rec { 84 pname = "lua-resty-lrucache"; 85 version = "0.13"; 86 87 src = fetchFromGitHub { 88 owner = "openresty"; 89 repo = "lua-resty-lrucache"; 90 rev = "v${version}"; 91 sha256 = "sha256-J8RNAMourxqUF8wPKd8XBhNwGC/x1KKvrVnZtYDEu4Q="; 92 }; 93 94 meta = with lib; { 95 description = "Lua-land LRU Cache based on LuaJIT FFI"; 96 homepage = "https://github.com/openresty/lua-resty-lrucache"; 97 license = licenses.bsd3; 98 maintainers = with maintainers; [ ]; 99 }; 100 }) {}; 101 102 luxio = callPackage ({ fetchurl, which, pkg-config }: buildLuaPackage rec { 103 pname = "luxio"; 104 version = "13"; 105 106 src = fetchurl { 107 url = "https://git.gitano.org.uk/luxio.git/snapshot/luxio-luxio-${version}.tar.bz2"; 108 sha256 = "1hvwslc25q7k82rxk461zr1a2041nxg7sn3sw3w0y5jxf0giz2pz"; 109 }; 110 111 nativeBuildInputs = [ which pkg-config ]; 112 113 postPatch = '' 114 patchShebangs const-proc.lua 115 ''; 116 117 preBuild = '' 118 makeFlagsArray=( 119 INST_LIBDIR="$out/lib/lua/${lua.luaversion}" 120 INST_LUADIR="$out/share/lua/${lua.luaversion}" 121 LUA_BINDIR="$out/bin" 122 INSTALL=install 123 ); 124 ''; 125 126 meta = with lib; { 127 broken = stdenv.isDarwin; 128 description = "Lightweight UNIX I/O and POSIX binding for Lua"; 129 homepage = "https://www.gitano.org.uk/luxio/"; 130 license = licenses.mit; 131 maintainers = with maintainers; [ richardipsum ]; 132 platforms = platforms.unix; 133 }; 134 }) {}; 135 136 nfd = callPackage ../development/lua-modules/nfd { 137 inherit (pkgs.gnome) zenity; 138 inherit (pkgs.darwin.apple_sdk.frameworks) AppKit; 139 }; 140 141 vicious = callPackage ({ fetchFromGitHub }: stdenv.mkDerivation rec { 142 pname = "vicious"; 143 version = "2.6.0"; 144 145 src = fetchFromGitHub { 146 owner = "vicious-widgets"; 147 repo = "vicious"; 148 rev = "v${version}"; 149 sha256 = "sha256-VlJ2hNou2+t7eSyHmFkC2xJ92OH/uJ/ewYHkFLQjUPQ="; 150 }; 151 152 buildInputs = [ lua ]; 153 154 installPhase = '' 155 mkdir -p $out/lib/lua/${lua.luaversion}/ 156 cp -r . $out/lib/lua/${lua.luaversion}/vicious/ 157 printf "package.path = '$out/lib/lua/${lua.luaversion}/?/init.lua;' .. package.path\nreturn require((...) .. '.init')\n" > $out/lib/lua/${lua.luaversion}/vicious.lua 158 ''; 159 160 meta = with lib; { 161 description = "A modular widget library for the awesome window manager"; 162 homepage = "https://vicious.rtfd.io"; 163 changelog = "https://vicious.rtfd.io/en/v${version}/changelog.html"; 164 license = licenses.gpl2Plus; 165 maintainers = with maintainers; [ makefu mic92 McSinyx ]; 166 platforms = platforms.linux; 167 }; 168 }) {}; 169}