Merge pull request #63108 from Shados/lua-packaging-improvements-pr

Lua/luarocks packaging improvements
This commit is contained in:
Matthieu Coudron 2019-06-19 14:23:31 +02:00 committed by GitHub
commit c33153bf13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 1106 additions and 947 deletions

View File

@ -3,10 +3,17 @@ ansicolors,,,,,
argparse,,,,, argparse,,,,,
basexx,,,,, basexx,,,,,
binaryheap,,,,,vcunat binaryheap,,,,,vcunat
bit32,,,,lua5_1,lblasc
busted,,,,,
cjson,lua-cjson,,,,
compat53,,,,,vcunat
coxpcall,,,1.17.0-1,,
cqueues,,,,,vcunat
cyrussasl,,,,,vcunat
digestif,,http://luarocks.org/dev,,lua5_3, digestif,,http://luarocks.org/dev,,lua5_3,
dkjson,,,,, dkjson,,,,,
fifo,,,,, fifo,,,,,
http,,,,, http,,,,,vcunat
inspect,,,,, inspect,,,,,
ldoc,,,,, ldoc,,,,,
lgi,,,,, lgi,,,,,
@ -15,35 +22,44 @@ lpeg_patterns,,,,,
lpeglabel,,,,, lpeglabel,,,,,
lpty,,,,, lpty,,,,,
lrexlib-gnu,,,,, lrexlib-gnu,,,,,
lrexlib-pcre,,,,,vyp
lrexlib-posix,,,,, lrexlib-posix,,,,,
ltermbox,,,,, ltermbox,,,,,
cjson,lua-cjson,,,,
lua-cmsgpack,,,,, lua-cmsgpack,,,,,
lua_cliargs,,,,,
lua-iconv,,,,, lua-iconv,,,,,
lua-lsp,,http://luarocks.org/dev,,, lua-lsp,,http://luarocks.org/dev,,,
lua-messagepack,,,,, lua-messagepack,,,,,
lua-term,,,,, lua-term,,,,,
lua-toml,,,,, lua-toml,,,,,
lua-zlib,,,,,koral lua-zlib,,,,,koral
lua_cliargs,,,,,
luabitop,,,,, luabitop,,,,,
luaevent,,,,,
luacheck,,,,, luacheck,,,,,
luadbi,,,,,
luadbi-mysql,,,,,
luadbi-postgresql,,,,,
luadbi-sqlite3,,,,,
luaevent,,,,,
luaexpat,,,,,flosse
luaffi,,http://luarocks.org/dev,,, luaffi,,http://luarocks.org/dev,,,
luafilesystem,,,1.7.0-2,,flosse vcunat
luaossl,,,,lua5_1,vcunat
luaposix,,,,,vyp lblasc luaposix,,,,,vyp lblasc
luasec,,,,,flosse
luasocket,,,,,
luasql-sqlite3,,,,,vyp
luassert,,,,,
luasystem,,,,,
luazip,,,,, luazip,,,,,
luuid,,,,, luuid,,,,,
luv,,,,,
markdown,,,,, markdown,,,,,
mediator_lua,,,,,
mpack,,,,,
nvim-client,,,,,
penlight,,,,, penlight,,,,,
rapidjson,,,,, rapidjson,,,,,
say,,,,, say,,,,,
std__debug,std._debug,,,, std__debug,std._debug,,,,
std_normalize,std.normalize,,,, std_normalize,std.normalize,,,,
luv,,,,, stdlib,,,,,vyp
luasystem,,,,,
mediator_lua,,http://luarocks.org/manifests/teto,,,
mpack,,,,,
nvim-client,,,,,
busted,,http://luarocks.org/manifests/teto,,,
luassert,,,,,
coxpcall,,https://luarocks.org/manifests/hisham,1.17.0-1,,

1 # nix name luarocks name server version luaversion maintainers
3 argparse
4 basexx
5 binaryheap vcunat
6 bit32 lua5_1 lblasc
7 busted
8 cjson lua-cjson
9 compat53 vcunat
10 coxpcall 1.17.0-1
11 cqueues vcunat
12 cyrussasl vcunat
13 digestif http://luarocks.org/dev lua5_3
14 dkjson
15 fifo
16 http vcunat
17 inspect
18 ldoc
19 lgi
22 lpeglabel
23 lpty
24 lrexlib-gnu
25 lrexlib-pcre vyp
26 lrexlib-posix
27 ltermbox
cjson lua-cjson
28 lua-cmsgpack
lua_cliargs
29 lua-iconv
30 lua-lsp http://luarocks.org/dev
31 lua-messagepack
32 lua-term
33 lua-toml
34 lua-zlib koral
35 lua_cliargs
36 luabitop
luaevent
37 luacheck
38 luadbi
39 luadbi-mysql
40 luadbi-postgresql
41 luadbi-sqlite3
42 luaevent
43 luaexpat flosse
44 luaffi http://luarocks.org/dev
45 luafilesystem 1.7.0-2 flosse vcunat
46 luaossl lua5_1 vcunat
47 luaposix vyp lblasc
48 luasec flosse
49 luasocket
50 luasql-sqlite3 vyp
51 luassert
52 luasystem
53 luazip
54 luuid
55 luv
56 markdown
57 mediator_lua
58 mpack
59 nvim-client
60 penlight
61 rapidjson
62 say
63 std__debug std._debug
64 std_normalize std.normalize
65 luv stdlib vyp
luasystem
mediator_lua http://luarocks.org/manifests/teto
mpack
nvim-client
busted http://luarocks.org/manifests/teto
luassert
coxpcall https://luarocks.org/manifests/hisham 1.17.0-1

View File

@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell #!/usr/bin/env nix-shell
#!nix-shell -p nix-prefetch-scripts luarocks-nix -i bash #!nix-shell update-luarocks-shell.nix -i bash
# You'll likely want to use # You'll likely want to use
# `` # ``
@ -8,17 +8,21 @@
# to update all libraries in that folder. # to update all libraries in that folder.
# to debug, redirect stderr to stdout with 2>&1 # to debug, redirect stderr to stdout with 2>&1
# stop the script upon C-C # stop the script upon C-C
set -eu -o pipefail set -eu -o pipefail
CSV_FILE="maintainers/scripts/luarocks-packages.csv" CSV_FILE="maintainers/scripts/luarocks-packages.csv"
TMP_FILE="$(mktemp)" TMP_FILE="$(mktemp)"
# Set in the update-luarocks-shell.nix
NIXPKGS_PATH="$LUAROCKS_NIXPKGS_PATH"
exit_trap() # 10 is a pretty arbitrary number of simultaneous jobs, but it is generally
{ # impolite to hit a webserver with *too* many simultaneous connections :)
local lc="$BASH_COMMAND" rc=$? PARALLEL_JOBS=10
test $rc -eq 0 || echo -e "*** error $rc: $lc.\nGenerated temporary file in $TMP_FILE" >&2
exit_trap() {
local lc="$BASH_COMMAND" rc=$?
test $rc -eq 0 || echo -e "*** error $rc: $lc.\nGenerated temporary file in $TMP_FILE" >&2
} }
print_help() { print_help() {
@ -37,19 +41,19 @@ fi
trap exit_trap EXIT trap exit_trap EXIT
while getopts ":hc:" opt; do while getopts ":hc:" opt; do
case $opt in case $opt in
h) h)
print_help print_help
;; ;;
c) c)
echo "Loading package list from $OPTARG !" >&2 echo "Loading package list from $OPTARG !" >&2
CSV_FILE="$OPTARG" CSV_FILE="$OPTARG"
;; ;;
\?) \?)
echo "Invalid option: -$OPTARG" >&2 echo "Invalid option: -$OPTARG" >&2
;; ;;
esac esac
shift $((OPTIND-1)) shift $((OPTIND - 1))
done done
GENERATED_NIXFILE="$1" GENERATED_NIXFILE="$1"
@ -72,43 +76,60 @@ FOOTER="
/* GENERATED */ /* GENERATED */
" "
function convert_pkg() {
function convert_pkg () {
nix_pkg_name="$1" nix_pkg_name="$1"
lua_pkg_name="$2" lua_pkg_name="$2"
server="${3:+--only-server=$3}" server="$3"
pkg_version="${4:-}" pkg_version="$4"
lua_version="${5:+--lua-dir=$(nix path-info nixpkgs.$5)/bin}" lua_version="$5"
maintainers="$6"
echo "looking at $lua_pkg_name (version $pkg_version) from server [$server]" >&2 if [ "${nix_pkg_name:0:1}" == "#" ]; then
cmd="luarocks nix $server $lua_version $lua_pkg_name $pkg_version" echo "Skipping comment ${*}" >&2
echo "Running $cmd" >&2 return
drv="$nix_pkg_name = $($cmd)" fi
if [ $? -ne 0 ]; then if [ -z "$lua_pkg_name" ]; then
echo "Failed to convert $pkg" >&2 echo "Using nix_name as lua_pkg_name for '$nix_pkg_name'" >&2
lua_pkg_name="$nix_pkg_name"
fi
echo "Building expression for $lua_pkg_name (version $pkg_version) from server [$server]" >&2
luarocks_args=(nix)
if [[ -n $server ]]; then
luarocks_args+=("--only-server=$server")
fi
if [[ -n $maintainers ]]; then
luarocks_args+=("--maintainers=$maintainers")
fi
if [[ -n $lua_version ]]; then
lua_drv_path=$(nix-build --no-out-link "$NIXPKGS_PATH" -A "$lua_version")
luarocks_args+=("--lua-dir=$lua_drv_path/bin")
fi
luarocks_args+=("$lua_pkg_name")
if [[ -n $pkg_version ]]; then
luarocks_args+=("$pkg_version")
fi
echo "Running 'luarocks ${luarocks_args[*]}'" >&2
if drv="$nix_pkg_name = $(luarocks "${luarocks_args[@]}")"; then
echo "$drv"
else else
echo "$drv" | tee -a "$TMP_FILE" echo "Failed to convert $nix_pkg_name" >&2
return 1
fi fi
} }
# params needed when called via callPackage # params needed when called via callPackage
echo "$HEADER" | tee "$TMP_FILE" echo "$HEADER" | tee "$TMP_FILE"
# list of packages with format # Ensure parallel can run our bash function
while IFS=, read -r nix_pkg_name lua_pkg_name server pkg_version luaversion export -f convert_pkg
do export SHELL=bash
if [ "${nix_pkg_name:0:1}" == "#" ]; then # Read each line in the csv file and run convert_pkg for each, in parallel
echo "Skipping comment ${nix_pkg_name}" >&2 parallel --group --keep-order --halt now,fail=1 --jobs "$PARALLEL_JOBS" --colsep ',' convert_pkg {} <"$CSV_FILE" | tee -a "$TMP_FILE"
continue
fi
if [ -z "$lua_pkg_name" ]; then
echo "Using nix_name as lua_pkg_name" >&2
lua_pkg_name="$nix_pkg_name"
fi
convert_pkg "$nix_pkg_name" "$lua_pkg_name" "$server" "$pkg_version" "$luaversion"
done < "$CSV_FILE"
# close the set # close the set
echo "$FOOTER" | tee -a "$TMP_FILE" echo "$FOOTER" | tee -a "$TMP_FILE"
cp "$TMP_FILE" "$GENERATED_NIXFILE" cp "$TMP_FILE" "$GENERATED_NIXFILE"
# vim: set ts=4 sw=4 ft=sh:

View File

@ -0,0 +1,9 @@
{ nixpkgs ? import ../.. { }
}:
with nixpkgs;
mkShell {
buildInputs = [
bash luarocks-nix nix-prefetch-scripts parallel
];
LUAROCKS_NIXPKGS_PATH = toString nixpkgs.path;
}

View File

@ -1,17 +1,9 @@
{ stdenv, fetchFromGitHub, pkgconfig, wrapGAppsHook { stdenv, fetchFromGitHub, pkgconfig, wrapGAppsHook
, help2man, lua5, luafilesystem, luajit, sqlite , help2man, luafilesystem, luajit, sqlite
, webkitgtk, gtk3, gst_all_1, glib-networking , webkitgtk, gtk3, gst_all_1, glib-networking
}: }:
let stdenv.mkDerivation rec {
lualibs = [luafilesystem];
getPath = lib : type : "${lib}/lib/lua/${lua5.luaversion}/?.${type};${lib}/share/lua/${lua5.luaversion}/?.${type}";
getLuaPath = lib : getPath lib "lua";
getLuaCPath = lib : getPath lib "so";
luaPath = stdenv.lib.concatStringsSep ";" (map getLuaPath lualibs);
luaCPath = stdenv.lib.concatStringsSep ";" (map getLuaCPath lualibs);
in stdenv.mkDerivation rec {
pname = "luakit"; pname = "luakit";
version = "2.1"; version = "2.1";
@ -27,7 +19,7 @@ in stdenv.mkDerivation rec {
]; ];
buildInputs = [ buildInputs = [
webkitgtk lua5 luafilesystem luajit sqlite gtk3 webkitgtk luafilesystem luajit sqlite gtk3
gst_all_1.gstreamer gst_all_1.gst-plugins-base gst_all_1.gstreamer gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-good gst_all_1.gst-plugins-bad gst_all_1.gst-plugins-ugly gst_all_1.gst-plugins-good gst_all_1.gst-plugins-bad gst_all_1.gst-plugins-ugly
gst_all_1.gst-libav gst_all_1.gst-libav
@ -36,8 +28,11 @@ in stdenv.mkDerivation rec {
preBuild = '' preBuild = ''
# build-utils/docgen/gen.lua:2: module 'lib.lousy.util' not found # build-utils/docgen/gen.lua:2: module 'lib.lousy.util' not found
# TODO: why is not this the default? # TODO: why is not this the default? The test runner adds
LUA_PATH=?.lua # ';./lib/?.lua;./lib/?/init.lua' to package.path, but the build-utils
# scripts don't add an equivalent
export LUA_PATH="$NIX_LUA_PATH;./?.lua;./?/init.lua"
export LUA_CPATH="$NIX_LUA_CPATH"
''; '';
makeFlags = [ makeFlags = [
@ -54,8 +49,8 @@ in stdenv.mkDerivation rec {
in '' in ''
gappsWrapperArgs+=( gappsWrapperArgs+=(
--prefix XDG_CONFIG_DIRS : "$out/etc/xdg" --prefix XDG_CONFIG_DIRS : "$out/etc/xdg"
--set LUA_PATH '${luaKitPath};${luaPath};' --prefix LUA_PATH ';' "${luaKitPath};$NIX_LUA_PATH"
--set LUA_CPATH '${luaCPath};' --prefix LUA_CPATH ';' "$NIX_LUA_CPATH"
) )
''; '';

View File

@ -27,12 +27,13 @@ name ? "${attrs.pname}-${attrs.version}"
, propagatedNativeBuildInputs ? [] , propagatedNativeBuildInputs ? []
# used to disable derivation, useful for specific lua versions # used to disable derivation, useful for specific lua versions
# TODO move from this setting meta.broken to a 'disabled' attribute on the
# package, then use that to skip/include in each lua${ver}Packages set?
, disabled ? false , disabled ? false
# Additional arguments to pass to the makeWrapper function, which wraps # Additional arguments to pass to the makeWrapper function, which wraps
# generated binaries. # generated binaries.
, makeWrapperArgs ? [] , makeWrapperArgs ? []
, external_deps ? propagatedBuildInputs ++ buildInputs
# Skip wrapping of lua programs altogether # Skip wrapping of lua programs altogether
, dontWrapLuaPrograms ? false , dontWrapLuaPrograms ? false
@ -42,11 +43,19 @@ name ? "${attrs.pname}-${attrs.version}"
, passthru ? {} , passthru ? {}
, doCheck ? false , doCheck ? false
# appended to the luarocks generated config # Non-Lua / system (e.g. C library) dependencies. Is a list of deps, where
# in peculiar variables like { EVENT_INCDIR } can be useful to work around # each dep is either a derivation, or an attribute set like
# luarocks limitations, ie, luarocks consider include/lib folders to be subfolders of the same package in external_deps_dirs # { name = "rockspec external_dependencies key"; dep = derivation; }
# as explained in https://github.com/luarocks/luarocks/issues/766 # The latter is used to work-around luarocks having a problem with
# multiple-output derivations as external deps:
# https://github.com/luarocks/luarocks/issues/766<Paste>
, externalDeps ? lib.unique (lib.filter (drv: !drv ? luaModule) (propagatedBuildInputs ++ buildInputs))
# Appended to the generated luarocks config
, extraConfig ? "" , extraConfig ? ""
# Inserted into the generated luarocks config in the "variables" table
, extraVariables ? ""
# The two above arguments have access to builder variables -- e.g. to $out
# relative to srcRoot, path to the rockspec to use when using rocks # relative to srcRoot, path to the rockspec to use when using rocks
, rockspecFilename ? "../*.rockspec" , rockspecFilename ? "../*.rockspec"
@ -58,44 +67,95 @@ name ? "${attrs.pname}-${attrs.version}"
# Keep extra attributes from `attrs`, e.g., `patchPhase', etc. # Keep extra attributes from `attrs`, e.g., `patchPhase', etc.
if disabled
then throw "${name} not supported for interpreter ${lua}"
else
let let
# TODO fix warnings "Couldn't load rockspec for ..." during manifest
deps_dirs= lib.concatStringsSep ", " ( # construction -- from initial investigation, appears it will require
map (x: "\"${builtins.toString x}\"") external_deps # upstream luarocks changes to fix cleanly (during manifest construction,
); # luarocks only looks for rockspecs in the default/system tree instead of all
# configured trees)
# TODO luarocks_config = "luarocks-config.lua";
# - add rocktrees (look at torch-distro.nix/https://github.com/luarocks/luarocks/wiki/Config-file-format)
# - silence warnings
luarocks_config = "luarocksConfig";
luarocks_content = '' luarocks_content = ''
local_cache = "" local_cache = ""
-- array of strings -- To prevent collisions when creating environments, we install the rock
external_deps_dirs = { -- files into per-package subdirectories
${deps_dirs} rocks_subdir = '${rocksSubdir}'
} -- Then we need to tell luarocks where to find the rock files per
-- dependency
rocks_trees = { rocks_trees = {
${lib.concatStringsSep "\n, " rocksTrees}
}
'' + lib.optionalString lua.pkgs.isLuaJIT ''
-- Luajit provides some additional functionality built-in; this exposes
-- that to luarock's dependency system
rocks_provided = {
jit='${lua.luaversion}-1';
ffi='${lua.luaversion}-1';
luaffi='${lua.luaversion}-1';
bit='${lua.luaversion}-1';
}
'' + ''
-- For single-output external dependencies
external_deps_dirs = {
${lib.concatStringsSep "\n, " externalDepsDirs}
}
variables = {
-- Some needed machinery to handle multiple-output external dependencies,
-- as per https://github.com/luarocks/luarocks/issues/766
${lib.optionalString (lib.length depVariables > 0) ''
${lib.concatStringsSep "\n " depVariables}''}
${extraVariables}
} }
${extraConfig} ${extraConfig}
''; '';
rocksSubdir = "${attrs.pname}-${version}-rocks";
externalDepsDirs = map
(x: "'${builtins.toString x}'")
(lib.filter (lib.isDerivation) externalDeps);
rocksTrees = lib.imap0
(i: dep: "{ name = [[dep-${toString i}]], root = '${dep}', rocks_dir = '${dep}/${dep.rocksSubdir}' }")
requiredLuaRocks;
# Filter out the lua derivation itself from the Lua module dependency
# closure, as it doesn't have a rock tree :)
requiredLuaRocks = lib.filter (d: d ? luaModule)
(lua.pkgs.requiredLuaModules propagatedBuildInputs);
# Explicitly point luarocks to the relevant locations for multiple-output
# derivations that are external dependencies, to work around an issue it has
# (https://github.com/luarocks/luarocks/issues/766)
depVariables = lib.concatMap ({name, dep}: [
"${name}_INCDIR='${lib.getDev dep}/include';"
"${name}_LIBDIR='${lib.getLib dep}/lib';"
"${name}_BINDIR='${lib.getBin dep}/bin';"
]) externalDeps';
# example externalDeps': [ { name = "CRYPTO"; dep = pkgs.openssl; } ]
externalDeps' = lib.filter (dep: !lib.isDerivation dep) externalDeps;
in in
toLuaModule ( lua.stdenv.mkDerivation ( toLuaModule ( lua.stdenv.mkDerivation (
builtins.removeAttrs attrs ["disabled" "checkInputs"] // { builtins.removeAttrs attrs ["disabled" "checkInputs" "externalDeps"] // {
name = namePrefix + name; name = namePrefix + name;
buildInputs = [ wrapLua lua.pkgs.luarocks ] buildInputs = [ wrapLua lua.pkgs.luarocks ]
++ buildInputs ++ buildInputs
++ lib.optionals doCheck checkInputs ++ lib.optionals doCheck checkInputs
++ (map (d: d.dep) externalDeps')
; ;
# propagate lua to active setup-hook in nix-shell # propagate lua to active setup-hook in nix-shell
propagatedBuildInputs = propagatedBuildInputs ++ [ lua ]; propagatedBuildInputs = propagatedBuildInputs ++ [ lua ];
doCheck = false; inherit doCheck;
# @-patterns do not capture formal argument default values, so we need to
# explicitly inherit this for it to be available as a shell variable in the
# builder
inherit rockspecFilename;
inherit rocksSubdir;
# enabled only for src.rock # enabled only for src.rock
setSourceRoot= let setSourceRoot= let
@ -162,23 +222,20 @@ builtins.removeAttrs attrs ["disabled" "checkInputs"] // {
nix_debug "ROCKSPEC $rockspecFilename" nix_debug "ROCKSPEC $rockspecFilename"
nix_debug "cwd: $PWD" nix_debug "cwd: $PWD"
$LUAROCKS make --deps-mode=none --tree $out ''${rockspecFilename} $LUAROCKS make --deps-mode=all --tree=$out ''${rockspecFilename}
# to prevent collisions when creating environments
# also added -f as it doesn't always exist
# don't remove the whole directory as
rm -rf $out/lib/luarocks/rocks-${lua.luaversion}/manifest
runHook postInstall runHook postInstall
''; '';
passthru = { passthru = {
inherit lua; # The lua interpreter inherit lua; # The lua interpreter
inherit externalDeps;
} // passthru; } // passthru;
meta = with lib.maintainers; { meta = with lib.maintainers; {
platforms = lua.meta.platforms; platforms = lua.meta.platforms;
# add extra maintainer(s) to every package # add extra maintainer(s) to every package
maintainers = (meta.maintainers or []) ++ [ ]; maintainers = (meta.maintainers or []) ++ [ ];
broken = disabled;
} // meta; } // meta;
})) }))

File diff suppressed because it is too large Load Diff

View File

@ -1,37 +0,0 @@
--- a/config 2013-02-18 19:36:44.000000000 +0400
+++ b/config 2014-10-01 08:36:37.104254404 +0400
@@ -1,12 +1,12 @@
# $Id: config,v 1.10 2008/05/30 17:21:18 tomas Exp $
# Driver (leave uncommented ONLY the line with the name of the driver)
-T= mysql
+#T= mysql
#T= oci8
#T= odbc
#T= postgres
#T= sqlite
-#T=sqlite3
+T=sqlite3
#T=firebird
# Installation directories
@@ -37,8 +37,8 @@
######## MySQL
#DRIVER_LIBS= -L/usr/local/mysql/lib -lmysqlclient -lz
#DRIVER_INCS= -I/usr/local/mysql/include
-DRIVER_LIBS= -L/usr/lib -lmysqlclient -lz
-DRIVER_INCS= -I/usr/include/mysql
+#DRIVER_LIBS= -L/usr/lib -lmysqlclient -lz
+#DRIVER_INCS= -I/usr/include/mysql
######## Oracle OCI8
#DRIVER_LIBS= -L/home/oracle/OraHome1/lib -lz -lclntsh
#DRIVER_INCS= -I/home/oracle/OraHome1/rdbms/demo -I/home/oracle/OraHome1/rdbms/public
@@ -51,7 +51,7 @@
#DRIVER_LIBS= -lsqlite
#DRIVER_INCS=
######## SQLite3
-#DRIVER_LIBS= -L/opt/local/lib -lsqlite3
+DRIVER_LIBS= -lsqlite3
#DRIVER_INCS= -I/opt/local/include
######## ODBC
#DRIVER_LIBS= -L/usr/local/lib -lodbc

View File

@ -0,0 +1,16 @@
diff -Naur 5.2/uuid/luuid.c rock/uuid/luuid.c
--- 5.2/uuid/luuid.c 2012-05-10 11:22:00.000000000 +1000
+++ rock/uuid/luuid.c 2019-06-13 15:13:10.374134079 +1000
@@ -64,7 +64,11 @@
LUALIB_API int luaopen_uuid(lua_State *L)
{
- luaL_newlib(L,R);
+ #if LUA_VERSION_NUM == 501
+ luaL_register(L,MYNAME,R);
+ #else
+ luaL_newlib(L,R);
+ #endif
lua_pushliteral(L,"version"); /** version */
lua_pushliteral(L,MYVERSION);
lua_settable(L,-3);

View File

@ -5,101 +5,72 @@ with super;
##########################################3 ##########################################3
#### manual fixes for generated packages #### manual fixes for generated packages
##########################################3 ##########################################3
lgi = super.lgi.overrideAttrs(oa: { bit32 = super.bit32.override({
nativeBuildInputs = [ pkgs.pkgconfig ]; disabled = !isLua51;
buildInputs = with pkgs; oa.buildInputs ++ [ glib gobjectIntrospection]; # Theoretically works with luajit, but it does redefine at least one Lua
# 5.2 function that Luajit 2.1 provides, see:
# https://github.com/LuaJIT/LuaJIT/issues/325
});
busted = super.busted.override({
postConfigure = ''
substituteInPlace ''${rockspecFilename} \
--replace "'lua_cliargs = 3.0-1'," "'lua_cliargs >= 3.0-1',"
'';
postInstall = ''
install -D completions/zsh/_busted $out/share/zsh/site-functions/_busted
install -D completions/bash/busted.bash $out/share/bash-completion/completions/busted
'';
});
cqueues = super.cqueues.override(rec {
# Parse out a version number without the Lua version inserted
version = with pkgs.lib; let
version' = super.cqueues.version;
rel = splitString "." version';
date = head rel;
rev = last (splitString "-" (last rel));
in "${date}-${rev}";
nativeBuildInputs = [
pkgs.gnum4
];
externalDeps = [
{ name = "CRYPTO"; dep = pkgs.openssl; }
{ name = "OPENSSL"; dep = pkgs.openssl; }
];
patches = [ patches = [
(pkgs.fetchpatch { # https://github.com/wahern/cqueues/issues/216 &
name = "lgi-find-cairo-through-typelib.patch"; # https://github.com/wahern/cqueues/issues/217
url = "https://github.com/psychon/lgi/commit/46a163d9925e7877faf8a4f73996a20d7cf9202a.patch"; (pkgs.fetchpatch {
sha256 = "0gfvvbri9kyzhvq3bvdbj2l6mwvlz040dk4mrd5m9gz79f7w109c"; name = "find-version-fix.patch";
}) url = "https://github.com/wahern/cqueues/pull/217.patch";
sha256 = "0068ql0jlxmjkvhzydyy52sjd0k4vad6b8w4y5szpbv4vb2lzcsc";
})
];
disabled = luaOlder "5.1" || luaAtLeast "5.4";
# Upstream rockspec is pointlessly broken into separate rockspecs, per Lua
# version, which doesn't work well for us, so modify it
postConfigure = let inherit (super.cqueues) pname; in ''
# 'all' target auto-detects correct Lua version, which is fine for us as
# we only have the right one available :)
sed -Ei ''${rockspecFilename} \
-e 's|lua == 5.[[:digit:]]|lua >= 5.1, <= 5.3|' \
-e 's|build_target = "[^"]+"|build_target = "all"|' \
-e 's|version = "[^"]+"|version = "${version}"|'
specDir=$(dirname ''${rockspecFilename})
cp ''${rockspecFilename} "$specDir/${pname}-${version}.rockspec"
rockspecFilename="$specDir/${pname}-${version}.rockspec"
'';
});
cyrussasl = super.cyrussasl.override({
externalDeps = [
{ name = "LIBSASL"; dep = pkgs.cyrus_sasl; }
]; ];
}); });
ltermbox = super.ltermbox.override( { http = super.http.override({
disabled = !isLua51 || isLuaJIT; patches = [
});
lua-cmsgpack = super.lua-cmsgpack.override({
# TODO this should work with luajit once we fix luajit headers ?
disabled = (!isLua51) || isLuaJIT;
});
lrexlib-posix = super.lrexlib-posix.override({
buildInputs = [ pkgs.glibc.dev ];
});
lrexlib-gnu = super.lrexlib-gnu.override({
buildInputs = [ pkgs.gnulib ];
});
lua-zlib = super.lua-zlib.override({
buildInputs = [ pkgs.zlib.dev ];
disabled=luaOlder "5.1" || luaAtLeast "5.4";
});
luaevent = super.luaevent.override({
buildInputs = with pkgs; [ libevent.dev libevent ];
propagatedBuildInputs = [ luasocket ];
extraConfig = ''
variables={
EVENT_INCDIR="${pkgs.libevent.dev}/include";
EVENT_LIBDIR="${pkgs.libevent}/lib";
}
'';
disabled= luaOlder "5.1" || luaAtLeast "5.4" || isLuaJIT;
});
lua-iconv = super.lua-iconv.override({
buildInputs = [ pkgs.libiconv ];
});
luazip = super.luazip.override({
buildInputs = [ pkgs.zziplib ];
});
luv = super.luv.overrideAttrs(oa: {
# Use system libuv instead of building local and statically linking
# This is a hacky way to specify -DWITH_SHARED_LIBUV=ON which
# should be possible but I'm unable to make work.
# While at it, remove bundled libuv source entirely to be sure.
# We may wish to drop bundled lua submodules too...
preBuild = ''
sed -i 's,\(option(WITH_SHARED_LIBUV.*\)OFF,\1ON,' CMakeLists.txt
rm -rf deps/libuv
'';
propagatedBuildInputs = oa.propagatedBuildInputs ++ [ pkgs.libuv ];
});
busted = super.busted.overrideAttrs(oa: {
postInstall = ''
install -D completions/zsh/_busted $out/share/zsh/site-functions/_busted
'';
});
luuid = super.luuid.override(oa: {
buildInputs = [ pkgs.libuuid ];
extraConfig = ''
variables = {
LIBUUID_INCDIR="${pkgs.lib.getDev pkgs.libuuid}/include";
LIBUUID_LIBDIR="${pkgs.lib.getLib pkgs.libuuid}/lib";
}
'';
meta = oa.meta // {
platforms = pkgs.lib.platforms.linux;
};
});
rapidjson = super.rapidjson.overrideAttrs(oa: {
preBuild = ''
sed -i '/set(CMAKE_CXX_FLAGS/d' CMakeLists.txt
sed -i '/set(CMAKE_C_FLAGS/d' CMakeLists.txt
'';
});
binaryheap = super.binaryheap.overrideAttrs(oa: {
meta = oa.meta // {
maintainers = with pkgs.lib.maintainers; oa.meta.maintainers ++ [ vcunat ];
};
});
http = super.http.overrideAttrs(oa: {
patches = oa.patches or [] ++ [
(pkgs.fetchpatch { (pkgs.fetchpatch {
name = "invalid-state-progression.patch"; name = "invalid-state-progression.patch";
url = "https://github.com/daurnimator/lua-http/commit/cb7b59474a.diff"; url = "https://github.com/daurnimator/lua-http/commit/cb7b59474a.diff";
@ -110,8 +81,184 @@ with super;
nativeBuildInputs = [ pandoc ]; nativeBuildInputs = [ pandoc ];
makeFlags = [ "-C doc" "lua-http.html" "lua-http.3" ]; makeFlags = [ "-C doc" "lua-http.html" "lua-http.3" ];
*/ */
meta = oa.meta // { });
maintainers = with pkgs.lib.maintainers; oa.meta.maintainers ++ [ vcunat ];
lgi = super.lgi.override({
nativeBuildInputs = [
pkgs.pkgconfig
];
buildInputs = [
pkgs.glib
pkgs.gobjectIntrospection
];
patches = [
(pkgs.fetchpatch {
name = "lgi-find-cairo-through-typelib.patch";
url = "https://github.com/psychon/lgi/commit/46a163d9925e7877faf8a4f73996a20d7cf9202a.patch";
sha256 = "0gfvvbri9kyzhvq3bvdbj2l6mwvlz040dk4mrd5m9gz79f7w109c";
})
];
});
lrexlib-gnu = super.lrexlib-gnu.override({
buildInputs = [
pkgs.gnulib
];
});
lrexlib-pcre = super.lrexlib-pcre.override({
externalDeps = [
{ name = "PCRE"; dep = pkgs.pcre; }
];
});
lrexlib-posix = super.lrexlib-posix.override({
buildInputs = [
pkgs.glibc.dev
];
});
ltermbox = super.ltermbox.override( {
disabled = !isLua51 || isLuaJIT;
});
lua-iconv = super.lua-iconv.override({
buildInputs = [
pkgs.libiconv
];
});
lua-zlib = super.lua-zlib.override({
buildInputs = [
pkgs.zlib.dev
];
disabled = luaOlder "5.1" || luaAtLeast "5.4";
});
luadbi-mysql = super.luadbi-mysql.override({
extraVariables = ''
-- Can't just be /include, unfortunately
MYSQL_INCDIR='${pkgs.mysql.connector-c}/include/mysql';
'';
buildInputs = [
pkgs.mysql.client
pkgs.mysql.connector-c
];
});
luadbi-postgresql = super.luadbi-postgresql.override({
buildInputs = [
pkgs.postgresql
];
});
luadbi-sqlite3 = super.luadbi-sqlite3.override({
externalDeps = [
{ name = "SQLITE"; dep = pkgs.sqlite; }
];
});
luaevent = super.luaevent.override({
propagatedBuildInputs = [
luasocket
];
externalDeps = [
{ name = "EVENT"; dep = pkgs.libevent; }
];
disabled = luaOlder "5.1" || luaAtLeast "5.4";
});
luaexpat = super.luaexpat.override({
externalDeps = [
{ name = "EXPAT"; dep = pkgs.expat; }
];
});
# TODO Somehow automatically amend buildInputs for things that need luaffi
# but are in luajitPackages?
luaffi = super.luaffi.override({
# The packaged .src.rock version is pretty old, and doesn't work with Lua 5.3
src = pkgs.fetchFromGitHub {
owner = "facebook"; repo = "luaffifb";
rev = "532c757e51c86f546a85730b71c9fef15ffa633d";
sha256 = "1nwx6sh56zfq99rcs7sph0296jf6a9z72mxknn0ysw9fd7m1r8ig";
}; };
knownRockspec = with super.luaffi; "${pname}-${version}.rockspec";
disabled = luaOlder "5.1" || luaAtLeast "5.4" || isLuaJIT;
});
luaossl = super.luaossl.override({
externalDeps = [
{ name = "CRYPTO"; dep = pkgs.openssl; }
{ name = "OPENSSL"; dep = pkgs.openssl; }
];
});
luasec = super.luasec.override({
externalDeps = [
{ name = "OPENSSL"; dep = pkgs.openssl; }
];
});
luasql-sqlite3 = super.luasql-sqlite3.override({
externalDeps = [
{ name = "SQLITE"; dep = pkgs.sqlite; }
];
});
luasystem = super.luasystem.override({
buildInputs = [
pkgs.glibc
];
});
luazip = super.luazip.override({
buildInputs = [
pkgs.zziplib
];
});
luuid = super.luuid.override(old: {
externalDeps = [
{ name = "LIBUUID"; dep = pkgs.libuuid; }
];
meta = old.meta // {
platforms = pkgs.lib.platforms.linux;
};
# Trivial patch to make it work in both 5.1 and 5.2. Basically just the
# tiny diff between the two upstream versions placed behind an #if.
# Upstreams:
# 5.1: http://webserver2.tecgraf.puc-rio.br/~lhf/ftp/lua/5.1/luuid.tar.gz
# 5.2: http://webserver2.tecgraf.puc-rio.br/~lhf/ftp/lua/5.2/luuid.tar.gz
patchFlags = "-p2";
patches = [
./luuid.patch
];
postConfigure = let inherit (super.luuid) version pname; in ''
sed -Ei ''${rockspecFilename} -e 's|lua >= 5.2|lua >= 5.1,|'
'';
disabled = luaOlder "5.1" || (luaAtLeast "5.4");
});
luv = super.luv.override({
# Use system libuv instead of building local and statically linking
# This is a hacky way to specify -DWITH_SHARED_LIBUV=ON which
# is not possible with luarocks and the current luv rockspec
# While at it, remove bundled libuv source entirely to be sure.
# We may wish to drop bundled lua submodules too...
preBuild = ''
sed -i 's,\(option(WITH_SHARED_LIBUV.*\)OFF,\1ON,' CMakeLists.txt
rm -rf deps/libuv
'';
propagatedBuildInputs = [
pkgs.libuv
];
});
rapidjson = super.rapidjson.override({
preBuild = ''
sed -i '/set(CMAKE_CXX_FLAGS/d' CMakeLists.txt
sed -i '/set(CMAKE_C_FLAGS/d' CMakeLists.txt
'';
}); });
} }

View File

@ -0,0 +1,24 @@
diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua
index c5af5a2..1949fdc 100644
--- a/src/luarocks/core/cfg.lua
+++ b/src/luarocks/core/cfg.lua
@@ -425,7 +425,7 @@ local function make_defaults(lua_version, target_cpu, platforms, home)
defaults.external_lib_extension = "dylib"
defaults.arch = "macosx-"..target_cpu
defaults.variables.LIBFLAG = "-bundle -undefined dynamic_lookup -all_load"
- local version = util.popen_read("sw_vers -productVersion")
+ local version = "10.10"
version = tonumber(version and version:match("^[^.]+%.([^.]+)")) or 3
if version >= 10 then
version = 8
@@ -434,8 +434,8 @@ local function make_defaults(lua_version, target_cpu, platforms, home)
else
defaults.gcc_rpath = false
end
- defaults.variables.CC = "env MACOSX_DEPLOYMENT_TARGET=10."..version.." gcc"
- defaults.variables.LD = "env MACOSX_DEPLOYMENT_TARGET=10."..version.." gcc"
+ defaults.variables.CC = "env MACOSX_DEPLOYMENT_TARGET=10."..version.." clang"
+ defaults.variables.LD = "env MACOSX_DEPLOYMENT_TARGET=10."..version.." clang"
defaults.web_browser = "open"
end

View File

@ -9,14 +9,14 @@
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "luarocks"; pname = "luarocks";
version = "3.0.4"; version = "3.1.3";
src = fetchurl { src = fetchurl {
url="http://luarocks.org/releases/luarocks-${version}.tar.gz"; url="http://luarocks.org/releases/luarocks-${version}.tar.gz";
sha256="1pqfzwvjy8dzqg4fqjq2cgqcr00fgrdd7nwzxm7nqmawr83s6dhj"; sha256="04q5k6drypsnbp1wspr9ns72k8kjf62a787a6jg1bb2s95gl6wy5";
}; };
patches = [ ./darwin.patch ]; patches = [ ./darwin-3.1.3.patch ];
preConfigure = '' preConfigure = ''
lua -e "" || { lua -e "" || {
luajit -e "" && { luajit -e "" && {

View File

@ -4,7 +4,10 @@ luarocks.overrideAttrs(old: {
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "teto"; owner = "teto";
repo = "luarocks"; repo = "luarocks";
rev = "595456f1246d66e5bdce0de838d0d6188274991c"; rev = "38ed82ba3e5682d7d55ef9a870dfb464ca180df9";
sha256 = "14nn0n5a0m516lnbwljy85h7y98zwnfbcyz7hgsm6fn4p8316yz2"; sha256 = "0vlzywiv3sxkpjg1fzzxicmfr6kh04fxw5q9n8vsd2075xjxg6bs";
}; };
patches = [
./darwin-3.0.x.patch
];
}) })

View File

@ -1,5 +1,5 @@
{ fetchurl, unzip, stdenv, makeWrapper, qtbase, yajl, libzip, hunspell { fetchurl, unzip, stdenv, makeWrapper, qtbase, yajl, libzip, hunspell
, boost, lua5_1, luafilesystem, luazip, lrexlib, luasqlite3, qmake }: , boost, lua5_1, luafilesystem, luazip, lrexlib-pcre, luasql-sqlite3, qmake }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "mudlet-${version}"; name = "mudlet-${version}";
@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ makeWrapper qmake ]; nativeBuildInputs = [ makeWrapper qmake ];
buildInputs = [ buildInputs = [
unzip qtbase lua5_1 hunspell libzip yajl boost unzip qtbase lua5_1 hunspell libzip yajl boost
luafilesystem luazip lrexlib luasqlite3 luafilesystem luazip lrexlib-pcre luasql-sqlite3
]; ];
preConfigure = "cd src"; preConfigure = "cd src";
@ -21,8 +21,8 @@ stdenv.mkDerivation rec {
installPhase = let installPhase = let
luaZipPath = "${luazip}/lib/lua/5.1/?.so"; luaZipPath = "${luazip}/lib/lua/5.1/?.so";
luaFileSystemPath = "${luafilesystem}/lib/lua/5.1/?.so"; luaFileSystemPath = "${luafilesystem}/lib/lua/5.1/?.so";
lrexlibPath = "${lrexlib}/lib/lua/5.1/?.so"; lrexlibPath = "${lrexlib-pcre}/lib/lua/5.1/?.so";
luasqlitePath = "${luasqlite3}/lib/lua/5.1/?.so"; luasqlitePath = "${luasql-sqlite3}/lib/lua/5.1/?.so";
in '' in ''
mkdir -pv $out/bin mkdir -pv $out/bin
cp mudlet $out cp mudlet $out

View File

@ -80,7 +80,7 @@ wrapped-full = runCommand unwrapped.name
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = [ makeWrapper ];
buildInputs = with luajitPackages; [ buildInputs = with luajitPackages; [
luasec luasocket # trust anchor bootstrap, prefill module luasec luasocket # trust anchor bootstrap, prefill module
lfs # prefill module luafilesystem # prefill module
http # for http module; brings lots of deps; some are useful elsewhere http # for http module; brings lots of deps; some are useful elsewhere
]; ];
preferLocalBuild = true; preferLocalBuild = true;

View File

@ -12,17 +12,6 @@ assert withDBI -> luadbi != null;
with stdenv.lib; with stdenv.lib;
let
libs = [ luasocket luasec luaexpat luafilesystem luabitop ]
++ optional withLibevent luaevent
++ optional withDBI luadbi
++ withExtraLibs;
getPath = lib : type : "${lib}/lib/lua/${lua5.luaversion}/?.${type};${lib}/share/lua/${lua5.luaversion}/?.${type}";
getLuaPath = lib : getPath lib "lua";
getLuaCPath = lib : getPath lib "so";
luaPath = concatStringsSep ";" (map getLuaPath libs);
luaCPath = concatStringsSep ";" (map getLuaCPath libs);
in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "0.11.2"; # also update communityModules version = "0.11.2"; # also update communityModules
@ -42,8 +31,17 @@ stdenv.mkDerivation rec {
sha256 = "0bzn92j48krb2zhp9gn5bbn5sg0qv15j5lpxfszwqdln3lpmrvzg"; sha256 = "0bzn92j48krb2zhp9gn5bbn5sg0qv15j5lpxfszwqdln3lpmrvzg";
}; };
buildInputs = [ lua5 makeWrapper libidn openssl ] buildInputs = [
++ optional withDBI luadbi; lua5 makeWrapper libidn openssl
]
# Lua libraries
++ [
luasocket luasec luaexpat luafilesystem luabitop
]
++ optional withLibevent luaevent
++ optional withDBI luadbi
++ withExtraLibs;
configureFlags = [ configureFlags = [
"--ostype=linux" "--ostype=linux"
@ -56,12 +54,12 @@ stdenv.mkDerivation rec {
cp -r $communityModules/mod_${module} $out/lib/prosody/modules/ cp -r $communityModules/mod_${module} $out/lib/prosody/modules/
'') (withCommunityModules ++ withOnlyInstalledCommunityModules)} '') (withCommunityModules ++ withOnlyInstalledCommunityModules)}
wrapProgram $out/bin/prosody \ wrapProgram $out/bin/prosody \
--set LUA_PATH '${luaPath};' \ --prefix LUA_PATH ';' "$NIX_LUA_PATH" \
--set LUA_CPATH '${luaCPath};' --prefix LUA_CPATH ';' "$NIX_LUA_CPATH"
wrapProgram $out/bin/prosodyctl \ wrapProgram $out/bin/prosodyctl \
--add-flags '--config "/etc/prosody/prosody.cfg.lua"' \ --add-flags '--config "/etc/prosody/prosody.cfg.lua"' \
--set LUA_PATH '${luaPath};' \ --prefix LUA_PATH ';' "$NIX_LUA_PATH" \
--set LUA_CPATH '${luaCPath};' --prefix LUA_CPATH ';' "$NIX_LUA_CPATH"
''; '';
passthru.communityModules = withCommunityModules; passthru.communityModules = withCommunityModules;

View File

@ -18904,8 +18904,7 @@ in
}; };
luakit = callPackage ../applications/networking/browsers/luakit { luakit = callPackage ../applications/networking/browsers/luakit {
inherit (lua51Packages) luafilesystem; inherit (luajitPackages) luafilesystem;
lua5 = lua5_1;
}; };
looking-glass-client = callPackage ../applications/virtualization/looking-glass-client { }; looking-glass-client = callPackage ../applications/virtualization/looking-glass-client { };
@ -21663,7 +21662,7 @@ in
mrrescue = callPackage ../games/mrrescue { }; mrrescue = callPackage ../games/mrrescue { };
mudlet = libsForQt5.callPackage ../games/mudlet { mudlet = libsForQt5.callPackage ../games/mudlet {
inherit (lua51Packages) luafilesystem lrexlib luazip luasqlite3; inherit (lua51Packages) luafilesystem lrexlib-pcre luazip luasql-sqlite3;
}; };
n2048 = callPackage ../games/n2048 {}; n2048 = callPackage ../games/n2048 {};

View File

@ -56,7 +56,7 @@ let
buildLuaApplication = args: buildLuarocksPackage ({namePrefix="";} // args ); buildLuaApplication = args: buildLuarocksPackage ({namePrefix="";} // args );
buildLuarocksPackage = with pkgs.lib; makeOverridable( callPackage ../development/interpreters/lua-5/build-lua-package.nix { buildLuarocksPackage = with pkgs.lib; makeOverridable(callPackage ../development/interpreters/lua-5/build-lua-package.nix {
inherit toLuaModule; inherit toLuaModule;
inherit lua; inherit lua;
}); });
@ -98,327 +98,6 @@ with self; {
luarocks-nix = callPackage ../development/tools/misc/luarocks/luarocks-nix.nix { }; luarocks-nix = callPackage ../development/tools/misc/luarocks/luarocks-nix.nix { };
bit32 = buildLuaPackage rec {
version = "5.3.0";
name = "bit32-${version}";
src = fetchFromGitHub {
owner = "keplerproject";
repo = "lua-compat-5.2";
rev = "bitlib-${version}";
sha256 = "1ipqlbvb5w394qwhm2f3w6pdrgy8v4q8sps5hh3pqz14dcqwakhj";
};
buildPhase = ''
cc ${if stdenv.isDarwin then "-bundle -undefined dynamic_lookup -all_load" else "-shared"} -Ic-api lbitlib.c -o bit32.so
'';
installPhase = ''
mkdir -p $out/lib/lua/${lua.luaversion}
install -p bit32.so $out/lib/lua/${lua.luaversion}
'';
meta = with stdenv.lib; {
description = "Lua 5.2 bit manipulation library";
homepage = "http://www.lua.org/manual/5.2/manual.html#6.7";
license = licenses.mit;
maintainers = with maintainers; [ lblasc ];
platforms = platforms.unix;
};
};
compat53 = buildLuaPackage rec {
version = "0.7";
name = "compat53-${version}";
src = fetchFromGitHub {
owner = "keplerproject";
repo = "lua-compat-5.3";
rev = "v${version}";
sha256 = "02a14nvn7aggg1yikj9h3dcf8aqjbxlws1bfvqbpfxv9d5phnrpz";
};
nativeBuildInputs = [ pkgconfig ];
postConfigure = ''
CFLAGS+=" -shared $(pkg-config --libs ${if isLuaJIT then "luajit" else "lua"})"
'';
buildPhase = ''
cc lstrlib.c $CFLAGS -o string.so
cc ltablib.c $CFLAGS -o table.so
cc lutf8lib.c $CFLAGS -o utf8.so
'';
# The hook in ../development/lua-modules/generic/default.nix
# is strict about share vs. lib for _PATH and _CPATH.
installPhase = ''
install -Dt "$out/share/lua/${lua.luaversion}/compat53" compat53/*.lua
install -Dt "$out/lib/lua/${lua.luaversion}/compat53" *.so
'';
meta = with stdenv.lib; {
description = "Compatibility module providing Lua-5.3-style APIs for Lua 5.2 and 5.1";
homepage = "https://github.com/keplerproject/lua-compat-5.3";
license = licenses.mit;
maintainers = with maintainers; [ vcunat ];
platforms = platforms.all;
};
};
cqueues = buildLuaPackage rec {
name = "cqueues-${version}";
version = "20171014";
src = fetchurl {
url = "https://www.25thandclement.com/~william/projects/releases/${name}.tgz";
sha256 = "1dabhpn6r0hlln8vx9hxm34pfcm46qzgpb2apmziwg5z51fi4ksb";
};
preConfigure = ''export prefix=$out'';
# https://github.com/wahern/cqueues/issues/216
NIX_CFLAGS_COMPILE = [ "-DCQUEUES_VERSION=${version}" ];
nativeBuildInputs = [ gnum4 ];
buildInputs = [ openssl ];
meta = with stdenv.lib; {
description = "A type of event loop for Lua";
homepage = "https://www.25thandclement.com/~william/projects/cqueues.html";
license = licenses.mit;
maintainers = with maintainers; [ vcunat ];
platforms = platforms.unix;
};
};
luacyrussasl = buildLuaPackage rec {
version = "1.1.0";
name = "lua-cyrussasl-${version}";
src = fetchFromGitHub {
owner = "JorjBauer";
repo = "lua-cyrussasl";
rev = "v${version}";
sha256 = "14kzm3vk96k2i1m9f5zvpvq4pnzaf7s91h5g4h4x2bq1mynzw2s1";
};
preBuild = ''
makeFlagsArray=(
CFLAGS="-O2 -fPIC"
LDFLAGS="-O -shared -fpic -lsasl2"
LUAPATH="$out/share/lua/${lua.luaversion}"
CPATH="$out/lib/lua/${lua.luaversion}"
);
mkdir -p $out/{share,lib}/lua/${lua.luaversion}
'';
buildInputs = [ cyrus_sasl ];
meta = with stdenv.lib; {
homepage = "https://github.com/JorjBauer/lua-cyrussasl";
description = "Cyrus SASL library for Lua 5.1+";
license = licenses.bsd3;
};
};
luaexpat = buildLuaPackage rec {
version = "1.3.0";
name = "expat-${version}";
src = fetchurl {
url = "https://matthewwild.co.uk/projects/luaexpat/luaexpat-${version}.tar.gz";
sha256 = "1hvxqngn0wf5642i5p3vcyhg3pmp102k63s9ry4jqyyqc1wkjq6h";
};
buildInputs = [ expat ];
preConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
substituteInPlace Makefile \
--replace '-shared' '-bundle -undefined dynamic_lookup -all_load'
'';
preBuild = ''
makeFlagsArray=(
LUA_LDIR="$out/share/lua/${lua.luaversion}"
LUA_INC="-I${lua}/include" LUA_CDIR="$out/lib/lua/${lua.luaversion}"
EXPAT_INC="-I${expat.dev}/include");
'';
disabled = isLua53 || isLuaJIT;
meta = with stdenv.lib; {
description = "SAX XML parser based on the Expat library";
homepage = "http://matthewwild.co.uk/projects/luaexpat";
license = licenses.mit;
maintainers = with maintainers; [ flosse ];
platforms = platforms.unix;
};
};
luadbi = buildLuaPackage rec {
name = "luadbi-${version}";
version = "0.7.2";
src = fetchFromGitHub {
owner = "mwild1";
repo = "luadbi";
rev = "v${version}";
sha256 = "167ivwmczhp98bxzpz3wdxcfj6vi0a10gpi7rdfjs2rbfwkzqvjh";
};
MYSQL_INC = [ "-I${mysql.connector-c}/include/mysql" ];
MYSQL_LDFLAGS= [
"-lmysqlclient"
"-L${mysql.connector-c}/lib/mysql"
];
nativeBuildInputs = [ mysql.client ];
buildInputs = [ mysql.connector-c postgresql sqlite ];
preConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
substituteInPlace Makefile \
--replace '-shared' '-bundle -undefined dynamic_lookup -all_load'
'';
installFlags = [
"LUA_CDIR=$(out)/lib/lua/${lua.luaversion}"
"LUA_LDIR=$(out)/share/lua/${lua.luaversion}"
];
installTargets = [
"install_lua" "install_mysql" "install_psql" "install_sqlite3"
];
meta = with stdenv.lib; {
homepage = https://github.com/mwild1/luadbi;
license = licenses.mit;
platforms = stdenv.lib.platforms.unix;
};
};
luafilesystem = buildLuaPackage rec {
version = "1.7.0";
name = "filesystem-${version}";
src = fetchFromGitHub {
owner = "keplerproject";
repo = "luafilesystem";
rev = "v${stdenv.lib.replaceChars ["."] ["_"] version}";
sha256 = "0fibrasshlgpa71m9wkpjxwmylnxpcf06rpqbaa0qwvqh94nhwby";
};
preConfigure = ''
substituteInPlace config --replace "CC= gcc" "";
''
+ stdenv.lib.optionalString stdenv.isDarwin ''
substituteInPlace config \
--replace 'LIB_OPTION= -shared' '###' \
--replace '#LIB_OPTION= -bundle' 'LIB_OPTION= -bundle'
substituteInPlace Makefile --replace '10.3' '10.5'
'';
meta = with stdenv.lib; {
description = "Lua library complementing filesystem-related functions";
homepage = "https://github.com/keplerproject/luafilesystem";
license = licenses.mit;
maintainers = with maintainers; [ flosse ];
platforms = platforms.unix;
};
};
luaossl = buildLuaPackage rec {
name = "luaossl-${version}";
version = "20181207";
src = fetchurl {
url = "https://github.com/wahern/luaossl/releases/download/rel-${version}/luaossl-rel-${version}.zip";
sha256 = "194r6db80ksh4zh8d2k35q6vci9zbrfvkanjl280y6ij2xyhkvj7";
};
preConfigure = ''export prefix=$out'';
nativeBuildInputs = [ unzip ];
buildInputs = [ openssl ];
meta = with stdenv.lib; {
description = "Comprehensive binding to OpenSSL for Lua 5.1+";
homepage = "https://www.25thandclement.com/~william/projects/luaossl.html";
license = licenses.mit;
maintainers = with maintainers; [ vcunat ];
platforms = platforms.unix;
};
};
luasec = buildLuaPackage rec {
name = "sec-0.8";
src = fetchFromGitHub {
owner = "brunoos";
repo = "luasec";
rev = "lua${name}";
sha256 = "1cgb7ihnrrfr59a2da4d3chr7lqpid98xpglmzhv3hrpg4x5sksz";
};
propagatedBuildInputs = [ luasocket ];
buildInputs = [ openssl ];
preBuild = ''
makeFlagsArray=(
${platformString}
LUAPATH="$out/share/lua/${lua.luaversion}"
LUACPATH="$out/lib/lua/${lua.luaversion}"
INC_PATH="-I${lua}/include"
LIB_PATH="-L$out/lib");
'';
meta = with stdenv.lib; {
description = "Lua binding for OpenSSL library to provide TLS/SSL communication";
homepage = "https://github.com/brunoos/luasec";
license = licenses.mit;
maintainers = with maintainers; [ flosse ];
platforms = platforms.unix;
};
};
luasocket = buildLuaPackage rec {
name = "socket-${version}";
version = "3.0-rc1";
src = fetchFromGitHub {
owner = "diegonehab";
repo = "luasocket";
rev = "v${version}";
sha256 = "1chs7z7a3i3lck4x7rz60ziwbf793gw169hpjdfca8y4yf1hzsxk";
};
patchPhase = stdenv.lib.optionalString stdenv.isDarwin ''
substituteInPlace src/makefile \
--replace 10.3 10.5
'';
preBuild = ''
makeFlagsArray=(
LUAV=${lua.luaversion}
PLAT=${platformString}
CC=''${CC}
LD=''${CC}
prefix=$out
);
'';
doCheck = false; # fails to find itself
installTargets = [ "install" "install-unix" ];
meta = with stdenv.lib; {
description = "Network support for Lua";
homepage = "http://w3.impa.br/~diego/software/luasocket/";
license = licenses.mit;
maintainers = with maintainers; [ ];
platforms = with platforms; darwin ++ linux ++ freebsd ++ illumos;
};
};
luxio = buildLuaPackage rec { luxio = buildLuaPackage rec {
name = "luxio-${version}"; name = "luxio-${version}";
version = "13"; version = "13";
@ -452,115 +131,6 @@ with self; {
}; };
}; };
luastdlib = buildLuaPackage rec {
name = "stdlib-${version}";
version = "41.2.1";
src = fetchFromGitHub {
owner = "lua-stdlib";
repo = "lua-stdlib";
rev = "release-v${version}";
sha256 = "03wd1qvkrj50fjszb2apzdkc8d5bpfbbi9pajl0vbrlzzmmi3jlq";
};
nativeBuildInputs = [ autoreconfHook unzip ];
meta = with stdenv.lib; {
description = "General Lua libraries";
homepage = "https://github.com/lua-stdlib/lua-stdlib";
license = licenses.mit;
maintainers = with maintainers; [ vyp ];
platforms = platforms.linux;
};
};
lrexlib = buildLuaPackage rec {
name = "lrexlib-${version}";
version = "2.8.0";
src = fetchFromGitHub {
owner = "rrthomas";
repo = "lrexlib";
rev = "rel-2-8-0";
sha256 = "1c62ny41b1ih6iddw5qn81gr6dqwfffzdp7q6m8x09zzcdz78zhr";
};
buildInputs = [ luastdlib pcre luarocks oniguruma gnulib tre glibc ];
buildPhase = let
luaVariable = ''LUA_PATH="${luastdlib}/share/lua/${lua.luaversion}/?/init.lua;${luastdlib}/share/lua/${lua.luaversion}/?.lua"'';
pcreVariable = "PCRE_DIR=${pcre.out} PCRE_INCDIR=${pcre.dev}/include";
onigVariable = "ONIG_DIR=${oniguruma}";
gnuVariable = "GNU_INCDIR=${gnulib}/lib";
treVariable = "TRE_DIR=${tre}";
posixVariable = "POSIX_DIR=${glibc.dev}";
in ''
sed -e 's@$(LUAROCKS) $(LUAROCKS_COMMAND) $$i;@$(LUAROCKS) $(LUAROCKS_COMMAND) $$i ${pcreVariable} ${onigVariable} ${gnuVariable} ${treVariable} ${posixVariable};@' -i Makefile
${luaVariable} make
'';
installPhase = ''
mkdir -pv $out;
cp -r luarocks/lib $out;
'';
meta = with stdenv.lib; {
description = "Lua bindings of various regex library APIs";
homepage = "https://github.com/rrthomas/lrexlib";
license = licenses.mit;
maintainers = with maintainers; [ vyp ];
platforms = platforms.linux;
};
};
luasqlite3 = buildLuaPackage rec {
name = "sqlite3-${version}";
version = "2.3.0";
src = fetchFromGitHub {
owner = "LuaDist";
repo = "luasql-sqlite3";
rev = version;
sha256 = "05k8zs8nsdmlwja3hdhckwknf7ww5cvbp3sxhk2xd1i3ij6aa10b";
};
disabled = isLua53;
buildInputs = [ sqlite ];
patches = [ ../development/lua-modules/luasql.patch ];
meta = with stdenv.lib; {
description = "Database connectivity for Lua";
homepage = "https://github.com/LuaDist/luasql-sqlite3";
license = licenses.mit;
maintainers = with maintainers; [ vyp ];
platforms = platforms.linux;
};
};
lfs = buildLuaPackage rec {
name = "lfs-${version}";
version = "1.7.0.2";
src = fetchFromGitHub {
owner = "keplerproject";
repo = "luafilesystem";
rev = "v" + stdenv.lib.replaceStrings ["."] ["_"] version;
sha256 = "0zmprgkm9zawdf9wnw0v3w6ibaj442wlc6alp39hmw610fl4vghi";
};
meta = with stdenv.lib; {
description = "Portable library for filesystem operations";
homepage = https://keplerproject.github.com/luafilesystem;
license = licenses.mit;
maintainers = with maintainers; [ vcunat ];
platforms = platforms.all;
};
};
vicious = toLuaModule(stdenv.mkDerivation rec { vicious = toLuaModule(stdenv.mkDerivation rec {
name = "vicious-${version}"; name = "vicious-${version}";
version = "2.3.1"; version = "2.3.1";