2014-09-19 20:40:37 +01:00
|
|
|
/* This file defines the composition for Lua packages. It has
|
|
|
|
been factored out of all-packages.nix because there are many of
|
|
|
|
them. Also, because most Nix expressions for Lua packages are
|
|
|
|
trivial, most are actually defined here. I.e. there's no function
|
|
|
|
for each package in a separate file: the call to the function would
|
|
|
|
be almost as must code as the function itself. */
|
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
{ fetchurl, stdenv, lua, unzip, pkg-config
|
2018-07-21 01:44:44 +01:00
|
|
|
, pcre, oniguruma, gnulib, tre, glibc, sqlite, openssl, expat
|
2019-06-16 20:59:06 +01:00
|
|
|
, autoreconfHook, gnum4
|
2021-03-14 16:11:57 +00:00
|
|
|
, postgresql, cyrus_sasl
|
2019-06-16 20:59:06 +01:00
|
|
|
, fetchFromGitHub, which, writeText
|
2019-01-30 14:13:15 +00:00
|
|
|
, pkgs
|
|
|
|
, lib
|
2014-10-12 20:04:52 +01:00
|
|
|
}:
|
2014-09-19 20:40:37 +01:00
|
|
|
|
2014-09-23 12:56:29 +01:00
|
|
|
let
|
2019-01-30 14:13:15 +00:00
|
|
|
packages = ( self:
|
|
|
|
|
|
|
|
let
|
|
|
|
luaAtLeast = lib.versionAtLeast lua.luaversion;
|
|
|
|
luaOlder = lib.versionOlder lua.luaversion;
|
|
|
|
isLua51 = (lib.versions.majorMinor lua.version) == "5.1";
|
|
|
|
isLua52 = (lib.versions.majorMinor lua.version) == "5.2";
|
2018-07-05 23:06:48 +01:00
|
|
|
isLua53 = lua.luaversion == "5.3";
|
2019-11-24 17:22:28 +00:00
|
|
|
isLuaJIT = lib.getName lua == "luajit";
|
2017-01-27 10:49:04 +00:00
|
|
|
|
2019-01-30 14:13:15 +00:00
|
|
|
lua-setup-hook = callPackage ../development/interpreters/lua-5/setup-hook.nix { };
|
|
|
|
|
|
|
|
# Check whether a derivation provides a lua module.
|
|
|
|
hasLuaModule = drv: drv ? luaModule ;
|
|
|
|
|
|
|
|
callPackage = pkgs.newScope self;
|
|
|
|
|
2021-01-10 11:03:59 +00:00
|
|
|
requiredLuaModules = drvs: with lib; let
|
2019-01-30 14:13:15 +00:00
|
|
|
modules = filter hasLuaModule drvs;
|
|
|
|
in unique ([lua] ++ modules ++ concatLists (catAttrs "requiredLuaModules" modules));
|
|
|
|
|
|
|
|
# Convert derivation to a lua module.
|
|
|
|
toLuaModule = drv:
|
|
|
|
drv.overrideAttrs( oldAttrs: {
|
|
|
|
# Use passthru in order to prevent rebuilds when possible.
|
|
|
|
passthru = (oldAttrs.passthru or {})// {
|
|
|
|
luaModule = lua;
|
|
|
|
requiredLuaModules = requiredLuaModules drv.propagatedBuildInputs;
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2017-01-27 10:49:04 +00:00
|
|
|
platformString =
|
|
|
|
if stdenv.isDarwin then "macosx"
|
|
|
|
else if stdenv.isFreeBSD then "freebsd"
|
|
|
|
else if stdenv.isLinux then "linux"
|
|
|
|
else if stdenv.isSunOS then "solaris"
|
|
|
|
else throw "unsupported platform";
|
|
|
|
|
2019-02-04 11:30:58 +00:00
|
|
|
buildLuaApplication = args: buildLuarocksPackage ({namePrefix="";} // args );
|
|
|
|
|
2019-06-13 12:01:10 +01:00
|
|
|
buildLuarocksPackage = with pkgs.lib; makeOverridable(callPackage ../development/interpreters/lua-5/build-lua-package.nix {
|
2019-02-04 11:30:58 +00:00
|
|
|
inherit toLuaModule;
|
2019-02-17 12:18:49 +00:00
|
|
|
inherit lua;
|
2019-02-04 11:30:58 +00:00
|
|
|
});
|
2019-01-30 14:13:15 +00:00
|
|
|
in
|
|
|
|
with self; {
|
|
|
|
|
|
|
|
getLuaPathList = majorVersion: [
|
2019-08-21 14:03:11 +01:00
|
|
|
"share/lua/${majorVersion}/?.lua"
|
|
|
|
"share/lua/${majorVersion}/?/init.lua"
|
2019-01-30 14:13:15 +00:00
|
|
|
];
|
|
|
|
getLuaCPathList = majorVersion: [
|
2019-08-21 14:03:11 +01:00
|
|
|
"lib/lua/${majorVersion}/?.so"
|
2019-01-30 14:13:15 +00:00
|
|
|
];
|
2014-09-19 20:40:37 +01:00
|
|
|
|
2016-06-12 03:11:31 +01:00
|
|
|
# helper functions for dealing with LUA_PATH and LUA_CPATH
|
2019-08-21 14:03:11 +01:00
|
|
|
getPath = drv: pathListForVersion:
|
|
|
|
lib.concatMapStringsSep ";" (path: "${drv}/${path}") (pathListForVersion lua.luaversion);
|
|
|
|
getLuaPath = drv: getPath drv getLuaPathList;
|
|
|
|
getLuaCPath = drv: getPath drv getLuaCPathList;
|
2016-06-12 03:11:31 +01:00
|
|
|
|
2014-09-19 20:40:37 +01:00
|
|
|
#define build lua package function
|
2018-02-25 20:48:48 +00:00
|
|
|
buildLuaPackage = callPackage ../development/lua-modules/generic {
|
|
|
|
inherit lua writeText;
|
|
|
|
};
|
2014-09-19 20:40:37 +01:00
|
|
|
|
2019-01-30 14:13:15 +00:00
|
|
|
|
|
|
|
inherit toLuaModule lua-setup-hook;
|
2019-02-04 11:30:58 +00:00
|
|
|
inherit buildLuarocksPackage buildLuaApplication;
|
2019-01-30 14:13:15 +00:00
|
|
|
inherit requiredLuaModules luaOlder luaAtLeast
|
2019-02-14 05:32:04 +00:00
|
|
|
isLua51 isLua52 isLua53 isLuaJIT lua callPackage;
|
2019-01-30 14:13:15 +00:00
|
|
|
|
2019-02-04 11:30:58 +00:00
|
|
|
# wraps programs in $out/bin with valid LUA_PATH/LUA_CPATH
|
|
|
|
wrapLua = callPackage ../development/interpreters/lua-5/wrap-lua.nix {
|
|
|
|
inherit lua; inherit (pkgs) makeSetupHook makeWrapper;
|
|
|
|
};
|
|
|
|
|
2014-09-23 15:01:02 +01:00
|
|
|
luarocks = callPackage ../development/tools/misc/luarocks {
|
|
|
|
inherit lua;
|
|
|
|
};
|
|
|
|
|
2019-01-22 06:06:07 +00:00
|
|
|
luarocks-nix = callPackage ../development/tools/misc/luarocks/luarocks-nix.nix { };
|
|
|
|
|
2017-09-24 15:02:02 +01:00
|
|
|
luxio = buildLuaPackage rec {
|
|
|
|
name = "luxio-${version}";
|
|
|
|
version = "13";
|
2017-10-13 04:48:17 +01:00
|
|
|
|
2017-09-24 15:02:02 +01:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://git.gitano.org.uk/luxio.git/snapshot/luxio-luxio-13.tar.bz2";
|
|
|
|
sha256 = "1hvwslc25q7k82rxk461zr1a2041nxg7sn3sw3w0y5jxf0giz2pz";
|
|
|
|
};
|
2017-10-13 04:48:17 +01:00
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
nativeBuildInputs = [ which pkg-config ];
|
2017-10-13 04:48:17 +01:00
|
|
|
|
2017-09-24 15:44:43 +01:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs .
|
|
|
|
'';
|
2017-10-13 04:48:17 +01:00
|
|
|
|
2017-09-24 15:02:02 +01:00
|
|
|
preBuild = ''
|
|
|
|
makeFlagsArray=(
|
|
|
|
INST_LIBDIR="$out/lib/lua/${lua.luaversion}"
|
|
|
|
INST_LUADIR="$out/share/lua/${lua.luaversion}"
|
|
|
|
LUA_BINDIR="$out/bin"
|
2017-09-24 15:44:43 +01:00
|
|
|
INSTALL=install
|
2017-09-24 15:02:02 +01:00
|
|
|
);
|
|
|
|
'';
|
2017-10-13 04:48:17 +01:00
|
|
|
|
2021-01-10 11:03:59 +00:00
|
|
|
meta = with lib; {
|
2017-10-13 04:48:17 +01:00
|
|
|
description = "Lightweight UNIX I/O and POSIX binding for Lua";
|
|
|
|
homepage = "https://www.gitano.org.uk/luxio/";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ richardipsum ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
2017-09-24 15:02:02 +01:00
|
|
|
};
|
|
|
|
|
2019-02-05 15:00:19 +00:00
|
|
|
vicious = toLuaModule(stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "vicious";
|
2020-12-19 10:01:05 +00:00
|
|
|
version = "2.5.0";
|
2015-08-06 07:29:07 +01:00
|
|
|
|
2017-03-30 19:06:37 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Mic92";
|
|
|
|
repo = "vicious";
|
|
|
|
rev = "v${version}";
|
2020-12-19 10:01:05 +00:00
|
|
|
sha256 = "0lb90334mz0my8ydsmnsnkki0xr58kinsg0hf9d6k4b0vjfi0r0a";
|
2015-08-06 07:29:07 +01:00
|
|
|
};
|
|
|
|
|
2017-10-13 04:48:17 +01:00
|
|
|
buildInputs = [ lua ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/lib/lua/${lua.luaversion}/
|
|
|
|
cp -r . $out/lib/lua/${lua.luaversion}/vicious/
|
|
|
|
printf "package.path = '$out/lib/lua/${lua.luaversion}/?/init.lua;' .. package.path\nreturn require((...) .. '.init')\n" > $out/lib/lua/${lua.luaversion}/vicious.lua
|
|
|
|
'';
|
|
|
|
|
2021-01-10 11:03:59 +00:00
|
|
|
meta = with lib; {
|
2017-12-22 09:06:27 +00:00
|
|
|
description = "A modular widget library for the awesome window manager";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/Mic92/vicious";
|
2015-08-06 07:29:07 +01:00
|
|
|
license = licenses.gpl2;
|
2017-03-30 19:06:37 +01:00
|
|
|
maintainers = with maintainers; [ makefu mic92 ];
|
2015-08-06 07:29:07 +01:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
2019-02-05 15:00:19 +00:00
|
|
|
});
|
2015-08-06 07:29:07 +01:00
|
|
|
|
2019-01-30 14:13:15 +00:00
|
|
|
});
|
2019-03-07 06:09:33 +00:00
|
|
|
in packages
|