lol
at 25.11-pre 294 lines 8.0 kB view raw
1/* 2 This file defines the composition for Lua packages. It has 3 been factored out of all-packages.nix because there are many of 4 them. Also, because most Nix expressions for Lua packages are 5 trivial, most are actually defined here. I.e. there's no function 6 for each package in a separate file: the call to the function would 7 be almost as must code as the function itself. 8*/ 9 10{ 11 pkgs, 12 stdenv, 13 lib, 14 lua, 15}: 16 17self: 18 19let 20 inherit (self) callPackage; 21 22 buildLuaApplication = args: buildLuarocksPackage ({ namePrefix = ""; } // args); 23 24 buildLuarocksPackage = lib.makeOverridable ( 25 callPackage ../development/interpreters/lua-5/build-luarocks-package.nix { } 26 ); 27 28 luaLib = callPackage ../development/lua-modules/lib.nix { }; 29 30 #define build lua package function 31 buildLuaPackage = callPackage ../development/lua-modules/generic { }; 32 33 getPath = 34 drv: pathListForVersion: lib.concatMapStringsSep ";" (path: "${drv}/${path}") pathListForVersion; 35 36in 37rec { 38 39 # Dont take luaPackages from "global" pkgs scope to avoid mixing lua versions 40 luaPackages = self; 41 42 # helper functions for dealing with LUA_PATH and LUA_CPATH 43 inherit luaLib; 44 45 getLuaPath = drv: getPath drv luaLib.luaPathList; 46 getLuaCPath = drv: getPath drv luaLib.luaCPathList; 47 48 inherit (callPackage ../development/interpreters/lua-5/hooks { }) 49 luarocksMoveDataFolder 50 luarocksCheckHook 51 ; 52 53 inherit lua; 54 inherit buildLuaPackage buildLuarocksPackage buildLuaApplication; 55 inherit (luaLib) 56 luaOlder 57 luaAtLeast 58 isLua51 59 isLua52 60 isLua53 61 isLuaJIT 62 requiredLuaModules 63 toLuaModule 64 hasLuaModule 65 ; 66 67 # wraps programs in $out/bin with valid LUA_PATH/LUA_CPATH 68 wrapLua = callPackage ../development/interpreters/lua-5/wrap-lua.nix { 69 inherit (pkgs.buildPackages) makeSetupHook makeWrapper; 70 }; 71 72 luarocks_bootstrap = toLuaModule (callPackage ../development/tools/misc/luarocks/default.nix { }); 73 74 # a fork of luarocks used to generate nix lua derivations from rockspecs 75 luarocks-nix = toLuaModule (callPackage ../development/tools/misc/luarocks/luarocks-nix.nix { }); 76 77 awesome-wm-widgets = callPackage ( 78 { 79 stdenv, 80 fetchFromGitHub, 81 lua, 82 lib, 83 }: 84 85 stdenv.mkDerivation { 86 pname = "awesome-wm-widgets"; 87 version = "0-unstable-2024-02-15"; 88 89 src = fetchFromGitHub { 90 owner = "streetturtle"; 91 repo = "awesome-wm-widgets"; 92 rev = "2a27e625056c50b40b1519eed623da253d36cc27"; 93 hash = "sha256-qz/kUIpuhWwTLbwbaES32wGKe4D2hfz90dnq+mrHrj0="; 94 }; 95 96 installPhase = '' 97 runHook preInstall 98 99 target=$out/lib/lua/${lua.luaversion}/awesome-wm-widgets 100 mkdir -p $target 101 cp -r $src/* $target 102 103 runHook postInstall 104 ''; 105 106 meta = { 107 description = "Widgets for Awesome window manager"; 108 homepage = "https://github.com/streetturtle/awesome-wm-widgets"; 109 license = lib.licenses.mit; 110 maintainers = with lib.maintainers; [ averdow ]; 111 }; 112 } 113 ) { }; 114 115 lua-pam = callPackage ( 116 { 117 fetchFromGitHub, 118 linux-pam, 119 openpam, 120 }: 121 buildLuaPackage rec { 122 pname = "lua-pam"; 123 version = "unstable-2015-07-03"; 124 # Needed for `disabled`, overridden in buildLuaPackage 125 name = "${pname}-${version}"; 126 127 src = fetchFromGitHub { 128 owner = "devurandom"; 129 repo = "lua-pam"; 130 rev = "3818ee6346a976669d74a5cbc2a83ad2585c5953"; 131 hash = "sha256-YlMZ5mM9Ij/9yRmgA0X1ahYVZMUx8Igj5OBvAMskqTg="; 132 fetchSubmodules = true; 133 }; 134 135 # The makefile tries to link to `-llua<luaversion>` 136 LUA_LIBS = "-llua"; 137 138 buildInputs = 139 lib.optionals stdenv.hostPlatform.isLinux [ linux-pam ] 140 ++ lib.optionals stdenv.hostPlatform.isDarwin [ openpam ]; 141 142 installPhase = '' 143 runHook preInstall 144 145 install -Dm755 pam.so $out/lib/lua/${lua.luaversion}/pam.so 146 147 runHook postInstall 148 ''; 149 150 # The package does not build with lua 5.4 or luaJIT 151 disabled = luaAtLeast "5.4" || isLuaJIT; 152 153 meta = with lib; { 154 description = "Lua module for PAM authentication"; 155 homepage = "https://github.com/devurandom/lua-pam"; 156 license = licenses.mit; 157 maintainers = with maintainers; [ traxys ]; 158 }; 159 } 160 ) { }; 161 162 lua-resty-core = callPackage ( 163 { fetchFromGitHub }: 164 buildLuaPackage rec { 165 pname = "lua-resty-core"; 166 version = "0.1.28"; 167 168 src = fetchFromGitHub { 169 owner = "openresty"; 170 repo = "lua-resty-core"; 171 rev = "v${version}"; 172 sha256 = "sha256-RJ2wcHTu447wM0h1fa2qCBl4/p9XL6ZqX9pktRW64RI="; 173 }; 174 175 propagatedBuildInputs = [ lua-resty-lrucache ]; 176 177 meta = with lib; { 178 description = "New FFI-based API for lua-nginx-module"; 179 homepage = "https://github.com/openresty/lua-resty-core"; 180 license = licenses.bsd3; 181 maintainers = [ ]; 182 }; 183 } 184 ) { }; 185 186 lua-resty-lrucache = callPackage ( 187 { fetchFromGitHub }: 188 buildLuaPackage rec { 189 pname = "lua-resty-lrucache"; 190 version = "0.13"; 191 192 src = fetchFromGitHub { 193 owner = "openresty"; 194 repo = "lua-resty-lrucache"; 195 rev = "v${version}"; 196 sha256 = "sha256-J8RNAMourxqUF8wPKd8XBhNwGC/x1KKvrVnZtYDEu4Q="; 197 }; 198 199 meta = with lib; { 200 description = "Lua-land LRU Cache based on LuaJIT FFI"; 201 homepage = "https://github.com/openresty/lua-resty-lrucache"; 202 license = licenses.bsd3; 203 maintainers = [ ]; 204 }; 205 } 206 ) { }; 207 208 luv = callPackage ../development/lua-modules/luv { }; 209 libluv = callPackage ../development/lua-modules/luv/lib.nix { }; 210 211 luxio = callPackage ( 212 { 213 fetchurl, 214 which, 215 pkg-config, 216 }: 217 buildLuaPackage rec { 218 pname = "luxio"; 219 version = "13"; 220 221 src = fetchurl { 222 url = "https://git.gitano.org.uk/luxio.git/snapshot/luxio-luxio-${version}.tar.bz2"; 223 sha256 = "1hvwslc25q7k82rxk461zr1a2041nxg7sn3sw3w0y5jxf0giz2pz"; 224 }; 225 226 nativeBuildInputs = [ 227 which 228 pkg-config 229 ]; 230 231 postPatch = '' 232 patchShebangs const-proc.lua 233 ''; 234 235 preBuild = '' 236 makeFlagsArray=( 237 INST_LIBDIR="$out/lib/lua/${lua.luaversion}" 238 INST_LUADIR="$out/share/lua/${lua.luaversion}" 239 LUA_BINDIR="$out/bin" 240 INSTALL=install 241 ); 242 ''; 243 244 meta = with lib; { 245 broken = stdenv.hostPlatform.isDarwin; 246 description = "Lightweight UNIX I/O and POSIX binding for Lua"; 247 homepage = "https://www.gitano.org.uk/luxio/"; 248 license = licenses.mit; 249 maintainers = with maintainers; [ richardipsum ]; 250 platforms = platforms.unix; 251 }; 252 } 253 ) { }; 254 255 nfd = callPackage ../development/lua-modules/nfd { 256 inherit (pkgs) zenity; 257 }; 258 259 vicious = callPackage ( 260 { fetchFromGitHub }: 261 stdenv.mkDerivation rec { 262 pname = "vicious"; 263 version = "2.6.0"; 264 265 src = fetchFromGitHub { 266 owner = "vicious-widgets"; 267 repo = "vicious"; 268 rev = "v${version}"; 269 sha256 = "sha256-VlJ2hNou2+t7eSyHmFkC2xJ92OH/uJ/ewYHkFLQjUPQ="; 270 }; 271 272 buildInputs = [ lua ]; 273 274 installPhase = '' 275 mkdir -p $out/lib/lua/${lua.luaversion}/ 276 cp -r . $out/lib/lua/${lua.luaversion}/vicious/ 277 printf "package.path = '$out/lib/lua/${lua.luaversion}/?/init.lua;' .. package.path\nreturn require((...) .. '.init')\n" > $out/lib/lua/${lua.luaversion}/vicious.lua 278 ''; 279 280 meta = with lib; { 281 description = "Modular widget library for the awesome window manager"; 282 homepage = "https://vicious.rtfd.io"; 283 changelog = "https://vicious.rtfd.io/en/v${version}/changelog.html"; 284 license = licenses.gpl2Plus; 285 maintainers = with maintainers; [ 286 makefu 287 mic92 288 McSinyx 289 ]; 290 platforms = platforms.linux; 291 }; 292 } 293 ) { }; 294}