nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at haskell-updates 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 bustedCheckHook 52 ; 53 54 inherit lua; 55 inherit buildLuaPackage buildLuarocksPackage buildLuaApplication; 56 inherit (luaLib) 57 luaOlder 58 luaAtLeast 59 isLua51 60 isLua52 61 isLua53 62 isLuaJIT 63 requiredLuaModules 64 toLuaModule 65 hasLuaModule 66 ; 67 68 # wraps programs in $out/bin with valid LUA_PATH/LUA_CPATH 69 wrapLua = callPackage ../development/interpreters/lua-5/wrap-lua.nix { }; 70 71 luarocks_bootstrap = toLuaModule (callPackage ../development/tools/misc/luarocks/default.nix { }); 72 73 # a fork of luarocks used to generate nix lua derivations from rockspecs 74 luarocks-nix = toLuaModule (callPackage ../development/tools/misc/luarocks/luarocks-nix.nix { }); 75 76 awesome-wm-widgets = callPackage ( 77 { 78 stdenv, 79 fetchFromGitHub, 80 lua, 81 lib, 82 }: 83 84 stdenv.mkDerivation { 85 pname = "awesome-wm-widgets"; 86 version = "0-unstable-2024-02-15"; 87 88 src = fetchFromGitHub { 89 owner = "streetturtle"; 90 repo = "awesome-wm-widgets"; 91 rev = "2a27e625056c50b40b1519eed623da253d36cc27"; 92 hash = "sha256-qz/kUIpuhWwTLbwbaES32wGKe4D2hfz90dnq+mrHrj0="; 93 }; 94 95 installPhase = '' 96 runHook preInstall 97 98 target=$out/lib/lua/${lua.luaversion}/awesome-wm-widgets 99 mkdir -p $target 100 cp -r $src/* $target 101 102 runHook postInstall 103 ''; 104 105 meta = { 106 description = "Widgets for Awesome window manager"; 107 homepage = "https://github.com/streetturtle/awesome-wm-widgets"; 108 license = lib.licenses.mit; 109 maintainers = with lib.maintainers; [ averdow ]; 110 }; 111 } 112 ) { }; 113 114 image-nvim = callPackage ../development/lua-modules/image-nvim { }; 115 116 lua-pam = callPackage ( 117 { 118 fetchFromGitHub, 119 linux-pam, 120 openpam, 121 }: 122 buildLuaPackage { 123 pname = "lua-pam"; 124 version = "unstable-2015-07-03"; 125 126 src = fetchFromGitHub { 127 owner = "devurandom"; 128 repo = "lua-pam"; 129 rev = "3818ee6346a976669d74a5cbc2a83ad2585c5953"; 130 hash = "sha256-YlMZ5mM9Ij/9yRmgA0X1ahYVZMUx8Igj5OBvAMskqTg="; 131 fetchSubmodules = true; 132 }; 133 134 # The makefile tries to link to `-llua<luaversion>` 135 LUA_LIBS = "-llua"; 136 137 buildInputs = 138 lib.optionals stdenv.hostPlatform.isLinux [ linux-pam ] 139 ++ lib.optionals stdenv.hostPlatform.isDarwin [ openpam ]; 140 141 installPhase = '' 142 runHook preInstall 143 144 install -Dm755 pam.so $out/lib/lua/${lua.luaversion}/pam.so 145 146 runHook postInstall 147 ''; 148 149 meta = { 150 # The package does not build with lua 5.4 or luaJIT 151 broken = luaAtLeast "5.4" || isLuaJIT; 152 description = "Lua module for PAM authentication"; 153 homepage = "https://github.com/devurandom/lua-pam"; 154 license = lib.licenses.mit; 155 maintainers = with lib.maintainers; [ traxys ]; 156 }; 157 } 158 ) { }; 159 160 lua-resty-core = callPackage ( 161 { fetchFromGitHub }: 162 buildLuaPackage rec { 163 pname = "lua-resty-core"; 164 version = "0.1.32"; 165 166 src = fetchFromGitHub { 167 owner = "openresty"; 168 repo = "lua-resty-core"; 169 rev = "v${version}"; 170 sha256 = "sha256-ba/ahIl8BDfyXIbaN6zVCh3UwY6JbAqqZEpXktOfeYo="; 171 }; 172 173 propagatedBuildInputs = [ lua-resty-lrucache ]; 174 175 meta = { 176 description = "New FFI-based API for lua-nginx-module"; 177 homepage = "https://github.com/openresty/lua-resty-core"; 178 license = lib.licenses.bsd3; 179 maintainers = [ ]; 180 }; 181 } 182 ) { }; 183 184 lua-resty-lrucache = callPackage ( 185 { fetchFromGitHub }: 186 buildLuaPackage rec { 187 pname = "lua-resty-lrucache"; 188 version = "0.15"; 189 190 src = fetchFromGitHub { 191 owner = "openresty"; 192 repo = "lua-resty-lrucache"; 193 rev = "v${version}"; 194 sha256 = "sha256-G2l4Zo9Xm/m4zRfxrgzEvRE5LMO+UuX3kd7FwlCnxDA="; 195 }; 196 197 meta = { 198 description = "Lua-land LRU Cache based on LuaJIT FFI"; 199 homepage = "https://github.com/openresty/lua-resty-lrucache"; 200 license = lib.licenses.bsd3; 201 maintainers = [ ]; 202 }; 203 } 204 ) { }; 205 206 luv = callPackage ../development/lua-modules/luv { }; 207 libluv = callPackage ../development/lua-modules/luv/lib.nix { }; 208 209 luxio = callPackage ( 210 { 211 fetchurl, 212 which, 213 pkg-config, 214 }: 215 buildLuaPackage rec { 216 pname = "luxio"; 217 version = "13"; 218 219 src = fetchurl { 220 url = "https://git.gitano.org.uk/luxio.git/snapshot/luxio-luxio-${version}.tar.bz2"; 221 sha256 = "1hvwslc25q7k82rxk461zr1a2041nxg7sn3sw3w0y5jxf0giz2pz"; 222 }; 223 224 nativeBuildInputs = [ 225 which 226 pkg-config 227 ]; 228 229 postPatch = '' 230 patchShebangs const-proc.lua 231 ''; 232 233 preBuild = '' 234 makeFlagsArray=( 235 INST_LIBDIR="$out/lib/lua/${lua.luaversion}" 236 INST_LUADIR="$out/share/lua/${lua.luaversion}" 237 LUA_BINDIR="$out/bin" 238 INSTALL=install 239 ); 240 ''; 241 242 meta = { 243 broken = stdenv.hostPlatform.isDarwin; 244 description = "Lightweight UNIX I/O and POSIX binding for Lua"; 245 homepage = "https://www.gitano.org.uk/luxio/"; 246 license = lib.licenses.mit; 247 maintainers = with lib.maintainers; [ richardipsum ]; 248 platforms = lib.platforms.unix; 249 }; 250 } 251 ) { }; 252 253 nfd = callPackage ../development/lua-modules/nfd { 254 inherit (pkgs) zenity; 255 }; 256 257 readline = callPackage ../development/lua-modules/readline { inherit (pkgs) readline; }; 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 = { 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 = lib.licenses.gpl2Plus; 285 maintainers = with lib.maintainers; [ 286 makefu 287 mic92 288 McSinyx 289 ]; 290 platforms = lib.platforms.linux; 291 }; 292 } 293 ) { }; 294}