diff --git a/maintainers/scripts/luarocks-packages.csv b/maintainers/scripts/luarocks-packages.csv new file mode 100644 index 000000000000..e7c42925c5b2 --- /dev/null +++ b/maintainers/scripts/luarocks-packages.csv @@ -0,0 +1,21 @@ +ansicolors, +argparse, +dkjson +lrexlib-gnu, +lrexlib-posix, +ltermbox, +lua-cmsgpack, +lua_cliargs, +lua-term, +luaffi,http://luarocks.org/dev, +luuid, +penlight, +say, +luv, +luasystem, +mediator_lua,http://luarocks.org/manifests/teto +mpack,http://luarocks.org/manifests/teto +nvim-client,http://luarocks.org/manifests/teto +busted,http://luarocks.org/manifests/teto +luassert,http://luarocks.org/manifests/teto +coxpcall,https://luarocks.org/manifests/hisham,1.17.0-1 diff --git a/maintainers/scripts/update-luarocks-packages b/maintainers/scripts/update-luarocks-packages new file mode 100755 index 000000000000..aa922c19860f --- /dev/null +++ b/maintainers/scripts/update-luarocks-packages @@ -0,0 +1,112 @@ +#!/usr/bin/env nix-shell +#!nix-shell -p nix-prefetch-scripts luarocks-nix -i bash + +# You'll likely want to use +# `` +# nixpkgs $ maintainers/scripts/update-luarocks-packages pkgs/development/lua-modules/generated-packages.nix +# `` +# to update all libraries in that folder. +# to debug, redirect stderr to stdout with 2>&1 + + +# stop the script upon C-C +set -eu -o pipefail + +if [ $# -lt 1 ]; then + print_help + exit 1 +fi + +CSV_FILE="maintainers/scripts/luarocks-packages.csv" +TMP_FILE="$(mktemp)" + +exit_trap() +{ + local lc="$BASH_COMMAND" rc=$? + test $rc -eq 0 || echo -e "*** error $rc: $lc.\nGenerated temporary file in $TMP_FILE" >&2 +} +trap exit_trap EXIT + +print_help() { + echo "Usage: $0 " + echo "(most likely pkgs/development/lua-modules/generated-packages.nix)" + echo "" + echo " -c to set the list of luarocks package to generate" + exit 1 +} + + +while getopts ":hc:" opt; do + case $opt in + h) + print_help + ;; + c) + echo "Loading package list from $OPTARG !" >&2 + CSV_FILE="$OPTARG" + ;; + \?) + echo "Invalid option: -$OPTARG" >&2 + ;; + esac + shift $((OPTIND-1)) +done + +GENERATED_NIXFILE="$1" + +HEADER=" +/* ${GENERATED_NIXFILE} is an auto-generated file -- DO NOT EDIT! +Regenerate it with: +nixpkgs$ ${0} ${GENERATED_NIXFILE} + +These packages are manually refined in lua-overrides.nix +*/ +{ self, lua, stdenv, fetchurl, fetchgit, pkgs, ... } @ args: +self: super: +with self; +{ +" + +FOOTER=" +} +/* GENERATED */ +" + + +function convert_pkg () { + pkg="$1" + server="" + if [ ! -z "$2" ]; then + server=" --server=$2" + fi + + version="${3:-}" + + echo "looking at $pkg (version $version) from server [$server]" >&2 + cmd="luarocks nix $server $pkg $version" + drv="$($cmd)" + if [ $? -ne 0 ]; then + echo "Failed to convert $pkg" >&2 + echo "$drv" >&2 + else + echo "$drv" | tee -a "$TMP_FILE" + fi +} + +# params needed when called via callPackage +echo "$HEADER" | tee "$TMP_FILE" + +# list of packages with format +# name,server,version +while IFS=, read -r pkg_name server version +do + if [ -z "$pkg_name" ]; then + echo "Skipping empty package name" >&2 + fi + convert_pkg "$pkg_name" "$server" "$version" +done < "$CSV_FILE" + +# close the set +echo "$FOOTER" | tee -a "$TMP_FILE" + +cp "$TMP_FILE" "$GENERATED_NIXFILE" diff --git a/pkgs/development/interpreters/lua-5/build-lua-package.nix b/pkgs/development/interpreters/lua-5/build-lua-package.nix new file mode 100644 index 000000000000..0bed5efe4f79 --- /dev/null +++ b/pkgs/development/interpreters/lua-5/build-lua-package.nix @@ -0,0 +1,182 @@ +# Generic builder for lua packages +{ lib +, lua +, stdenv +, wrapLua +, unzip +, writeText +# Whether the derivation provides a lua module or not. +, toLuaModule +}: + +{ +name ? "${attrs.pname}-${attrs.version}" + +, version + +# by default prefix `name` e.g. "lua5.2-${name}" +, namePrefix ? "lua" + lua.luaversion + "-" + +# Dependencies for building the package +, buildInputs ? [] + +# Dependencies needed for running the checkPhase. +# These are added to buildInputs when doCheck = true. +, checkInputs ? [] + +# propagate build dependencies so in case we have A -> B -> C, +# C can import package A propagated by B +, propagatedBuildInputs ? [] +, propagatedNativeBuildInputs ? [] + +# used to disable derivation, useful for specific lua versions +, disabled ? false + +# Additional arguments to pass to the makeWrapper function, which wraps +# generated binaries. +, makeWrapperArgs ? [] +, external_deps ? propagatedBuildInputs ++ buildInputs + +# Skip wrapping of lua programs altogether +, dontWrapLuaPrograms ? false + +, meta ? {} + +, passthru ? {} +, doCheck ? false + +# appended to the luarocks generated config +# in peculiar variables like { EVENT_INCDIR } can be useful to work around +# luarocks limitations, ie, luarocks consider include/lib folders to be subfolders of the same package in external_deps_dirs +# as explained in https://github.com/luarocks/luarocks/issues/766 +, extraConfig ? "" + +# relative to srcRoot, path to the rockspec to use when using rocks +, rockspecFilename ? "../*.rockspec" + +# must be set for packages that don't have a rock +, knownRockspec ? null + +, ... } @ attrs: + + +# Keep extra attributes from `attrs`, e.g., `patchPhase', etc. +if disabled +then throw "${name} not supported for interpreter ${lua}" +else + +let + + deps_dirs= lib.concatStringsSep ", " ( + map (x: "\"${builtins.toString x}\"") external_deps + ); + + # TODO + # - add rocktrees (look at torch-distro.nix/https://github.com/luarocks/luarocks/wiki/Config-file-format) + # - silence warnings + luarocks_config = "luarocksConfig"; + luarocks_content = '' + local_cache = "" + -- array of strings + external_deps_dirs = { + ${deps_dirs} + } + rocks_trees = { + } + ${extraConfig} + ''; +in +toLuaModule ( lua.stdenv.mkDerivation ( +builtins.removeAttrs attrs ["disabled" "checkInputs"] // { + + name = namePrefix + name; + + buildInputs = [ wrapLua lua.pkgs.luarocks ] + ++ buildInputs + ++ lib.optionals doCheck checkInputs + ; + + # propagate lua to active setup-hook in nix-shell + propagatedBuildInputs = propagatedBuildInputs ++ [ lua ]; + doCheck = false; + + # enabled only for src.rock + setSourceRoot= let + name_only=(builtins.parseDrvName name).name; + in + lib.optionalString (knownRockspec == null) '' + # format is rockspec_basename/source_basename + # rockspec can set it via spec.source.dir + folder=$(find . -mindepth 2 -maxdepth 2 -type d -path '*${name_only}*/*'|head -n1) + sourceRoot="$folder" + ''; + + configurePhase = '' + runHook preConfigure + + cat > ${luarocks_config} <= 1 )); then + LUAROCKS="$LUAROCKS --verbose" + fi + + patchShebangs . + + runHook postBuild + ''; + + postFixup = lib.optionalString (!dontWrapLuaPrograms) '' + wrapLuaPrograms + '' + attrs.postFixup or ''''; + + installPhase = attrs.installPhase or '' + runHook preInstall + + # luarocks make assumes sources are available in cwd + # After the build is complete, it also installs the rock. + # If no argument is given, it looks for a rockspec in the current directory + # but some packages have several rockspecs in their source directory so + # we force the use of the upper level since it is + # the sole rockspec in that folder + # maybe we could reestablish dependency checking via passing --rock-trees + + nix_debug "ROCKSPEC $rockspecFilename" + nix_debug "cwd: $PWD" + $LUAROCKS make --deps-mode=none --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/manifest + + runHook postInstall + ''; + + passthru = { + inherit lua; # The lua interpreter + } // passthru; + + meta = with lib.maintainers; { + platforms = lua.meta.platforms; + # add extra maintainer(s) to every package + maintainers = (meta.maintainers or []) ++ [ ]; + } // meta; +})) diff --git a/pkgs/development/interpreters/lua-5/setup-hook.sh b/pkgs/development/interpreters/lua-5/setup-hook.sh index 5e37bd27f617..3989bedffdb1 100644 --- a/pkgs/development/interpreters/lua-5/setup-hook.sh +++ b/pkgs/development/interpreters/lua-5/setup-hook.sh @@ -1,7 +1,7 @@ # set -e nix_print() { - if (( "${NIX_DEBUG:-0}" >= $1 )); then + if [ ${NIX_DEBUG:-0} -ge $1 ]; then echo "$2" fi } @@ -32,13 +32,13 @@ addToLuaPath() { cd "$dir" for pattern in @luapathsearchpaths@; do - addToLuaSearchPathWithCustomDelimiter LUA_PATH "$PWD/$pattern" + addToLuaSearchPathWithCustomDelimiter NIX_LUA_PATH "$PWD/$pattern" done # LUA_CPATH for pattern in @luacpathsearchpaths@; do - addToLuaSearchPathWithCustomDelimiter LUA_CPATH "$PWD/$pattern" + addToLuaSearchPathWithCustomDelimiter NIX_LUA_CPATH "$PWD/$pattern" done cd - >/dev/null } diff --git a/pkgs/development/interpreters/lua-5/wrap-lua.nix b/pkgs/development/interpreters/lua-5/wrap-lua.nix new file mode 100644 index 000000000000..f00e0d5ac336 --- /dev/null +++ b/pkgs/development/interpreters/lua-5/wrap-lua.nix @@ -0,0 +1,19 @@ +{ lib +, lua +, makeSetupHook +, makeWrapper +}: + +with lib; + +# defined in trivial-builders.nix +# imported as wrapLua in lua-packages.nix and passed to build-lua-derivation to be used as buildInput +makeSetupHook { + deps = makeWrapper; + substitutions.executable = lua.interpreter; + substitutions.lua = lua; + substitutions.LuaPathSearchPaths = lib.escapeShellArgs lua.LuaPathSearchPaths; + substitutions.LuaCPathSearchPaths = lib.escapeShellArgs lua.LuaPathSearchPaths; + +} ./wrap.sh + diff --git a/pkgs/development/interpreters/lua-5/wrap.sh b/pkgs/development/interpreters/lua-5/wrap.sh new file mode 100644 index 000000000000..545a0ae271c4 --- /dev/null +++ b/pkgs/development/interpreters/lua-5/wrap.sh @@ -0,0 +1,99 @@ +# Inspired by python/wrapper.nix +# Wrapper around wrapLuaProgramsIn, below. The $luaPath +# variable is passed in from the buildLuarocksPackage function. +set -e + +wrapLuaPrograms() { + wrapLuaProgramsIn "$out/bin" "$out $luaPath" +} + +# Builds environment variables like LUA_PATH and PATH walking through closure +# of dependencies. +buildLuaPath() { + local luaPath="$1" + local path + + # Create an empty table of paths (see doc on loadFromPropagatedInputs + # for how this is used). Build up the program_PATH and program_LUA_PATH + # variables. + declare -A luaPathsSeen=() + program_PATH= + luaPathsSeen["@lua@"]=1 + addToSearchPath program_PATH @lua@/bin + for path in $luaPath; do + addToLuaPath "$path" + done +} + + +# with an executable shell script which will set some environment variables +# and then call into the original binary (which has been given a .wrapped suffix). +# luaPath is a list of directories +wrapLuaProgramsIn() { + local dir="$1" + local luaPath="$2" + local f + + buildLuaPath "$luaPath" + + if [ ! -d "$dir" ]; then + nix_debug "$dir not a directory" + return + fi + + nix_debug "wrapping programs in [$dir]" + + # Find all regular files in the output directory that are executable. + find "$dir" -type f -perm -0100 -print0 | while read -d "" f; do + # Rewrite "#! .../env lua" to "#! /nix/store/.../lua". + # Strip suffix, like "3" or "2.7m" -- we don't have any choice on which + # Lua to use besides one with this hook anyway. + if head -n1 "$f" | grep -q '#!.*/env.*\(lua\)'; then + sed -i "$f" -e "1 s^.*/env[ ]*\(lua\)[^ ]*^#! @executable@^" + fi + + # wrapProgram creates the executable shell script described + # above. The script will set LUA_(C)PATH and PATH variables! + # (see pkgs/build-support/setup-hooks/make-wrapper.sh) + local -a wrap_args=("$f" + --prefix PATH ':' "$program_PATH" + --prefix LUA_PATH ';' "$NIX_LUA_PATH" + --prefix LUA_CPATH ';' "$NIX_LUA_CPATH" + ) + + # Add any additional arguments provided by makeWrapperArgs + # argument to buildLuaPackage. + # makeWrapperArgs + local -a user_args="($makeWrapperArgs)" + local -a wrapProgramArgs=("${wrap_args[@]}" "${user_args[@]}") + + # see setup-hooks/make-wrapper.sh + wrapProgram "${wrapProgramArgs[@]}" + + done +} + +# Adds the lib and bin directories to the LUA_PATH and PATH variables, +# respectively. Recurses on any paths declared in +# `propagated-native-build-inputs`, while avoiding duplicating paths by +# flagging the directories it has visited in `luaPathsSeen`. +loadFromPropagatedInputs() { + local dir="$1" + # Stop if we've already visited here. + if [ -n "${luaPathsSeen[$dir]}" ]; then + return; + fi + luaPathsSeen[$dir]=1 + + addToLuaPath "$dir" + addToSearchPath program_PATH $dir/bin + + # Inspect the propagated inputs (if they exist) and recur on them. + local prop="$dir/nix-support/propagated-native-build-inputs" + if [ -e "$prop" ]; then + local new_path + for new_path in $(cat $prop); do + loadFromPropagatedInputs "$new_path" + done + fi +} diff --git a/pkgs/development/interpreters/lua-5/wrapper.nix b/pkgs/development/interpreters/lua-5/wrapper.nix index 9abbd77d575e..7f584c0f0aff 100644 --- a/pkgs/development/interpreters/lua-5/wrapper.nix +++ b/pkgs/development/interpreters/lua-5/wrapper.nix @@ -44,7 +44,7 @@ let rm -f "$out/bin/$prg" if [ -x "$prg" ]; then nix_debug "Making wrapper $prg" - makeWrapper "$path/bin/$prg" "$out/bin/$prg" --suffix LUA_PATH ';' "$LUA_PATH" --suffix LUA_CPATH ';' "$LUA_CPATH" ${stdenv.lib.concatStringsSep " " makeWrapperArgs} + makeWrapper "$path/bin/$prg" "$out/bin/$prg" --suffix LUA_PATH ';' "$NIX_LUA_PATH" --suffix LUA_CPATH ';' "$NIX_LUA_CPATH" ${stdenv.lib.concatStringsSep " " makeWrapperArgs} fi fi done diff --git a/pkgs/development/lua-modules/default.nix b/pkgs/development/lua-modules/default.nix index c20d4d02c65f..372d609792c2 100644 --- a/pkgs/development/lua-modules/default.nix +++ b/pkgs/development/lua-modules/default.nix @@ -6,12 +6,25 @@ let - inherit (lib) extends makeExtensible; + inherit (lib) extends; initialPackages = (pkgs.callPackage ../../top-level/lua-packages.nix { inherit lua; }); - extensible-self = makeExtensible initialPackages; + overridenPackages = import ./overrides.nix { inherit pkgs; }; + + generatedPackages = if (builtins.pathExists ./generated-packages.nix) then + pkgs.callPackage ./generated-packages.nix { } else (self: super: {}); + + extensible-self = lib.makeExtensible + (extends overrides + (extends overridenPackages + (extends generatedPackages + initialPackages + ) + ) + ) + ; in extensible-self diff --git a/pkgs/development/lua-modules/generated-packages.nix b/pkgs/development/lua-modules/generated-packages.nix new file mode 100644 index 000000000000..353eaa6e9601 --- /dev/null +++ b/pkgs/development/lua-modules/generated-packages.nix @@ -0,0 +1,482 @@ + +/* pkgs/development/lua-modules/generated-packages.nix is an auto-generated file -- DO NOT EDIT! +Regenerate it with: +nixpkgs$ maintainers/scripts/update-luarocks-packages pkgs/development/lua-modules/generated-packages.nix + +These packages are manually refined in lua-overrides.nix +*/ +{ self, lua, stdenv, fetchurl, fetchgit, pkgs, ... } @ args: +self: super: +with self; +{ + +ansicolors = buildLuarocksPackage { + pname = "ansicolors"; + version = "1.0.2-3"; + + src = fetchurl { + url = https://luarocks.org/ansicolors-1.0.2-3.src.rock; + sha256 = "1mhmr090y5394x1j8p44ws17sdwixn5a0r4i052bkfgk3982cqfz"; + }; + disabled = ( luaOlder "5.1"); + propagatedBuildInputs = [lua ]; + buildType="builtin"; + + meta = { + homepage = "https://github.com/kikito/ansicolors.lua"; + description="Library for color Manipulation."; + license = { + fullName = "MIT "; + }; + }; +}; +argparse = buildLuarocksPackage { + pname = "argparse"; + version = "0.6.0-1"; + + src = fetchurl { + url = https://luarocks.org/argparse-0.6.0-1.src.rock; + sha256 = "10ic5wppyghd1lmgwgl0lb40pv8z9fi9i87080axxg8wsr19y0p4"; + }; + disabled = ( luaOlder "5.1") || ( luaAtLeast "5.4"); + propagatedBuildInputs = [lua ]; + buildType="builtin"; + + meta = { + homepage = "https://github.com/mpeterv/argparse"; + description="A feature-rich command-line argument parser"; + license = { + fullName = "MIT"; + }; + }; +}; +dkjson = buildLuarocksPackage { + pname = "dkjson"; + version = "2.5-2"; + + src = fetchurl { + url = https://luarocks.org/dkjson-2.5-2.src.rock; + sha256 = "1qy9bzqnb9pf9d48hik4iq8h68aw3270kmax7mmpvvpw7kkyp483"; + }; + disabled = ( luaOlder "5.1") || ( luaAtLeast "5.4"); + propagatedBuildInputs = [lua ]; + buildType="builtin"; + + meta = { + homepage = "http://dkolf.de/src/dkjson-lua.fsl/"; + description="David Kolf's JSON module for Lua"; + license = { + fullName = "MIT/X11"; + }; + }; +}; +lrexlib-gnu = buildLuarocksPackage { + pname = "lrexlib-gnu"; + version = "2.9.0-1"; + + src = fetchurl { + url = https://luarocks.org/lrexlib-gnu-2.9.0-1.src.rock; + sha256 = "036rda4rji1pbnbxk1nzjy5zmigdsiacqbzrbvciwq3lrxa2j5s2"; + }; + disabled = ( luaOlder "5.1"); + propagatedBuildInputs = [lua ]; + buildType="builtin"; + + meta = { + homepage = "http://github.com/rrthomas/lrexlib"; + description="Regular expression library binding (GNU flavour)."; + license = { + fullName = "MIT/X11"; + }; + }; +}; +lrexlib-posix = buildLuarocksPackage { + pname = "lrexlib-posix"; + version = "2.9.0-1"; + + src = fetchurl { + url = https://luarocks.org/lrexlib-posix-2.9.0-1.src.rock; + sha256 = "0ifpybf4m94g1nk70l0f5m45gph0rbp5wrxrl1hnw8ibv3mc1b1r"; + }; + disabled = ( luaOlder "5.1"); + propagatedBuildInputs = [lua ]; + buildType="builtin"; + + meta = { + homepage = "http://github.com/rrthomas/lrexlib"; + description="Regular expression library binding (POSIX flavour)."; + license = { + fullName = "MIT/X11"; + }; + }; +}; +ltermbox = buildLuarocksPackage { + pname = "ltermbox"; + version = "0.2-1"; + + src = fetchurl { + url = https://luarocks.org/ltermbox-0.2-1.src.rock; + sha256 = "08jqlmmskbi1ml1i34dlmg6hxcs60nlm32dahpxhcrgjnfihmyn8"; + }; + disabled = ( luaOlder "5.1"); + propagatedBuildInputs = [lua ]; + buildType="builtin"; + + meta = { + homepage = "http://code.google.com/p/termbox"; + description="A termbox library package"; + license = { + fullName = "New BSD License"; + }; + }; +}; +lua-cmsgpack = buildLuarocksPackage { + pname = "lua-cmsgpack"; + version = "0.4.0-0"; + + knownRockspec = ( fetchurl { + url = https://luarocks.org/lua-cmsgpack-0.4.0-0.rockspec; + sha256 = "10cvr6knx3qvjcw1q9v05f2qy607mai7lbq321nx682aa0n1fzin"; + }).outPath; + + src = fetchgit ( removeAttrs (builtins.fromJSON ''{ + "url": "git://github.com/antirez/lua-cmsgpack.git", + "rev": "57b1f90cf6cec46450e87289ed5a676165d31071", + "date": "2018-06-14T11:56:56+02:00", + "sha256": "0yiwl4p1zh9qid3ksc4n9fv5bwaa9vjb0vgwnkars204xmxdj8fj", + "fetchSubmodules": true +} + '') ["date"]) ; + + disabled = ( luaOlder "5.1"); + propagatedBuildInputs = [lua ]; + buildType="builtin"; + + meta = { + homepage = "http://github.com/antirez/lua-cmsgpack"; + description="MessagePack C implementation and bindings for Lua 5.1/5.2/5.3"; + license = { + fullName = "Two-clause BSD"; + }; + }; +}; +lua_cliargs = buildLuarocksPackage { + pname = "lua_cliargs"; + version = "3.0-2"; + + src = fetchurl { + url = https://luarocks.org/lua_cliargs-3.0-2.src.rock; + sha256 = "0qqdnw00r16xbyqn4w1xwwpg9i9ppc3c1dcypazjvdxaj899hy9w"; + }; + disabled = ( luaOlder "5.1"); + propagatedBuildInputs = [lua ]; + buildType="builtin"; + + meta = { + homepage = "https://github.com/amireh/lua_cliargs"; + description="A command-line argument parser."; + license = { + fullName = "MIT "; + }; + }; +}; +lua-term = buildLuarocksPackage { + pname = "lua-term"; + version = "0.7-1"; + + knownRockspec = ( fetchurl { + url = https://luarocks.org/lua-term-0.7-1.rockspec; + sha256 = "0r9g5jw7pqr1dyj6w58dqlr7y7l0jp077n8nnji4phf10biyrvg2"; + }).outPath; + + src = fetchurl { + url = https://github.com/hoelzro/lua-term/archive/0.07.tar.gz; + sha256 = "0c3zc0cl3a5pbdn056vnlan16g0wimv0p9bq52h7w507f72x18f1"; + }; + + + + buildType="builtin"; + + meta = { + homepage = "https://github.com/hoelzro/lua-term"; + description="Terminal functions for Lua"; + license = { + fullName = "MIT/X11"; + }; + }; +}; +luaffi = buildLuarocksPackage { + pname = "luaffi"; + version = "scm-1"; + + src = fetchurl { + url = http://luarocks.org/dev/luaffi-scm-1.src.rock; + sha256 = "0dia66w8sgzw26bwy36gzyb2hyv7kh9n95lh5dl0158rqa6fsf26"; + }; + disabled = ( luaOlder "5.1"); + propagatedBuildInputs = [lua ]; + buildType="builtin"; + + meta = { + homepage = "https://github.com/facebook/luaffifb"; + description="FFI library for calling C functions from lua"; + license = { + fullName = "BSD"; + }; + }; +}; +luuid = buildLuarocksPackage { + pname = "luuid"; + version = "20120509-2"; + + src = fetchurl { + url = https://luarocks.org/luuid-20120509-2.src.rock; + sha256 = "08q54x0m51w89np3n117h2a153wsgv3qayabd8cz6i55qm544hkg"; + }; + disabled = ( luaOlder "5.2") || ( luaAtLeast "5.4"); + propagatedBuildInputs = [lua ]; + buildType="builtin"; + + meta = { + homepage = "http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/#luuid"; + description="A library for UUID generation"; + license = { + fullName = "Public domain"; + }; + }; +}; +penlight = buildLuarocksPackage { + pname = "penlight"; + version = "1.5.4-1"; + + knownRockspec = ( fetchurl { + url = https://luarocks.org/penlight-1.5.4-1.rockspec; + sha256 = "07mhsk9kmdxg4i2w4mrnnd2zs34bgggi9gigfplakxin96sa6c0p"; + }).outPath; + + src = fetchurl { + url = http://stevedonovan.github.io/files/penlight-1.5.4.zip; + sha256 = "138f921p6kdqkmf4pz115phhj0jsqf28g33avws80d2vq2ixqm8q"; + }; + + + propagatedBuildInputs = [luafilesystem ]; + buildType="builtin"; + + meta = { + homepage = "http://stevedonovan.github.com/Penlight"; + description="Lua utility libraries loosely based on the Python standard libraries"; + license = { + fullName = "MIT/X11"; + }; + }; +}; +say = buildLuarocksPackage { + pname = "say"; + version = "1.3-1"; + + knownRockspec = ( fetchurl { + url = https://luarocks.org/say-1.3-1.rockspec; + sha256 = "0bknglb0qwd6r703wp3hcb6z2xxd14kq4md3sg9al3b28fzxbhdv"; + }).outPath; + + src = fetchurl { + url = https://github.com/Olivine-Labs/say/archive/v1.3-1.tar.gz; + sha256 = "1jh76mxq9dcmv7kps2spwcc6895jmj2sf04i4y9idaxlicvwvs13"; + }; + + disabled = ( luaOlder "5.1"); + propagatedBuildInputs = [lua ]; + buildType="builtin"; + + meta = { + homepage = "http://olivinelabs.com/busted/"; + description="Lua String Hashing/Indexing Library"; + license = { + fullName = "MIT "; + }; + }; +}; +luv = buildLuarocksPackage { + pname = "luv"; + version = "1.22.0-1"; + + knownRockspec = ( fetchurl { + url = https://luarocks.org/luv-1.22.0-1.rockspec; + sha256 = "0yxjy9wj4aqbv1my8fkciy2xar5si6bcsszipgyls24rl6lnmga3"; + }).outPath; + + src = fetchurl { + url = https://github.com/luvit/luv/releases/download/1.22.0-1/luv-1.22.0-1.tar.gz; + sha256 = "1xvz4a0r6kd1xqxwm55g9n6imprxb79600x7dhyillrz7p5nm217"; + }; + + disabled = ( luaOlder "5.1"); + propagatedBuildInputs = [lua ]; + buildType="cmake"; + + meta = { + homepage = "https://github.com/luvit/luv"; + description="Bare libuv bindings for lua"; + license = { + fullName = "Apache 2.0"; + }; + }; +}; +luasystem = buildLuarocksPackage { + pname = "luasystem"; + version = "0.2.1-0"; + + src = fetchurl { + url = https://luarocks.org/luasystem-0.2.1-0.src.rock; + sha256 = "091xmp8cijgj0yzfsjrn7vljwznjnjn278ay7z9pjwpwiva0diyi"; + }; + disabled = ( luaOlder "5.1"); + propagatedBuildInputs = [lua ]; + buildType="builtin"; + + meta = { + homepage = "http://olivinelabs.com/luasystem/"; + description="Platform independent system calls for Lua."; + license = { + fullName = "MIT "; + }; + }; +}; +mediator_lua = buildLuarocksPackage { + pname = "mediator_lua"; + version = "1.1.2-0"; + + src = fetchurl { + url = http://luarocks.org/manifests/teto/mediator_lua-1.1.2-0.src.rock; + sha256 = "18j49vvs94yfk4fw0xsq4v3j4difr6c99gfba0kxairmcqamd1if"; + }; + disabled = ( luaOlder "5.1"); + propagatedBuildInputs = [lua ]; + buildType="builtin"; + + meta = { + homepage = "http://olivinelabs.com/mediator_lua/"; + description="Event handling through channels"; + license = { + fullName = "MIT "; + }; + }; +}; +mpack = buildLuarocksPackage { + pname = "mpack"; + version = "1.0.7-0"; + + src = fetchurl { + url = http://luarocks.org/manifests/teto/mpack-1.0.7-0.src.rock; + sha256 = "0nq4ixaminkc7fwfpivysyv0al3j5dffsvgdrnwnqdg3w7jgfbw7"; + }; + + + buildType="builtin"; + + meta = { + homepage = "https://github.com/libmpack/libmpack-lua/releases/download/1.0.7/libmpack-lua-1.0.7.tar.gz"; + description="Lua binding to libmpack"; + license = { + fullName = "MIT"; + }; + }; +}; +nvim-client = buildLuarocksPackage { + pname = "nvim-client"; + version = "0.1.0-1"; + + src = fetchurl { + url = https://luarocks.org/nvim-client-0.1.0-1.src.rock; + sha256 = "1p57mrvm0ny3yi5cydr3z9qwzyg124rjp5w7vdflf2i23z39mkma"; + }; + disabled = ( luaOlder "5.1"); + propagatedBuildInputs = [lua mpack luv coxpcall ]; + buildType="builtin"; + + meta = { + homepage = "https://github.com/neovim/lua-client/archive/0.1.0-1.tar.gz"; + description="Lua client to Nvim"; + license = { + fullName = "Apache"; + }; + }; +}; +busted = buildLuarocksPackage { + pname = "busted"; + version = "2.0.rc13-0"; + + knownRockspec = ( fetchurl { + url = https://luarocks.org/busted-2.0.rc13-0.rockspec; + sha256 = "0hrvhg1324q5ra6cpjh1y3by6lrzs0ljah4jl48l8xlgw1z9z1q5"; + }).outPath; + + src = fetchurl { + url = https://github.com/Olivine-Labs/busted/archive/v2.0.rc13-0.tar.gz; + sha256 = "0m72bldn1r6j94ahcfmpaq1mmysrshf9qi9fjas7hpal0jp8ivvl"; + }; + + disabled = ( luaOlder "5.1"); + propagatedBuildInputs = [lua lua_cliargs luafilesystem luasystem dkjson say luassert lua-term penlight mediator_lua ]; + buildType="builtin"; + + meta = { + homepage = "http://olivinelabs.com/busted/"; + description="Elegant Lua unit testing."; + license = { + fullName = "MIT "; + }; + }; +}; +luassert = buildLuarocksPackage { + pname = "luassert"; + version = "1.7.11-0"; + + knownRockspec = ( fetchurl { + url = https://luarocks.org/luassert-1.7.11-0.rockspec; + sha256 = "12zgybcv8acjzvjdbxd1764s1vxbksxdv9fkvsymcsdmppxkbd0s"; + }).outPath; + + src = fetchurl { + url = https://github.com/Olivine-Labs/luassert/archive/v1.7.11.tar.gz; + sha256 = "1vwq3wqj9cjyz9lnf1n38yhpcglr2h40v3n9096i8vcpmyvdb3ka"; + }; + + disabled = ( luaOlder "5.1"); + propagatedBuildInputs = [lua say ]; + buildType="builtin"; + + meta = { + homepage = "http://olivinelabs.com/busted/"; + description="Lua Assertions Extension"; + license = { + fullName = "MIT "; + }; + }; +}; +coxpcall = buildLuarocksPackage { + pname = "coxpcall"; + version = "1.17.0-1"; + + src = fetchurl { + url = https://luarocks.org/manifests/hisham/coxpcall-1.17.0-1.src.rock; + sha256 = "0n1jmda4g7x06458596bamhzhcsly6x0p31yp6q3jz4j11zv1zhi"; + }; + + + buildType="builtin"; + + meta = { + homepage = "http://keplerproject.github.io/coxpcall"; + description="Coroutine safe xpcall and pcall"; + license = { + fullName = "MIT/X11"; + }; + }; +}; + +} +/* GENERATED */ + diff --git a/pkgs/development/lua-modules/overrides.nix b/pkgs/development/lua-modules/overrides.nix new file mode 100644 index 000000000000..20a24681b6ae --- /dev/null +++ b/pkgs/development/lua-modules/overrides.nix @@ -0,0 +1,33 @@ +{ pkgs, ... }@args: +self: super: +with super; +{ + ##########################################3 + #### manual fixes for generated packages + ##########################################3 + + ltermbox = super.ltermbox.override( { + disabled = !isLua51 || isLuaJIT; + }); + + 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 ]; + }); + luv = super.luv.overrideAttrs(oa: { + propagatedBuildInputs = oa.propagatedBuildInputs ++ [ pkgs.libuv ]; + }); + + busted = super.busted.overrideAttrs(oa: { + postInstall = '' + install -D completions/zsh/_busted $out/share/zsh/site-functions/_busted + ''; + }); + } diff --git a/pkgs/development/tools/misc/luarocks/luarocks-nix.nix b/pkgs/development/tools/misc/luarocks/luarocks-nix.nix index 3728caf193ae..a918cb0c6475 100644 --- a/pkgs/development/tools/misc/luarocks/luarocks-nix.nix +++ b/pkgs/development/tools/misc/luarocks/luarocks-nix.nix @@ -3,7 +3,7 @@ luarocks.overrideAttrs(old: { src = fetchFromGitHub { owner = "teto"; repo = "luarocks"; - rev = "d669e8e118e6ca8bff05f32dbc9e5589e6ac45d2"; - sha256 = "1lay3905a5sx2a4y68lbys0913qs210hcj9kn2lbqinw86c1vyc3"; + rev = "f9dc7892214bff6bce822d94aca3331048e61df0"; + sha256 = "117qqbiv87p2qw0zwapl7b0p4wgnn9f8k0qpppkj3653a1bwli05"; }; }) diff --git a/pkgs/top-level/lua-packages.nix b/pkgs/top-level/lua-packages.nix index 50dd4d1fcd9a..11e05b504b43 100644 --- a/pkgs/top-level/lua-packages.nix +++ b/pkgs/top-level/lua-packages.nix @@ -56,6 +56,12 @@ let else if stdenv.isSunOS then "solaris" else throw "unsupported platform"; + buildLuaApplication = args: buildLuarocksPackage ({namePrefix="";} // args ); + + buildLuarocksPackage = with pkgs.lib; makeOverridable( callPackage ../development/interpreters/lua-5/build-lua-package.nix { + inherit toLuaModule; + inherit lua writeText; + }); in with self; { @@ -79,9 +85,15 @@ with self; { inherit toLuaModule lua-setup-hook; + inherit buildLuarocksPackage buildLuaApplication; inherit requiredLuaModules luaOlder luaAtLeast isLua51 isLua52 isLuaJIT lua callPackage; + # 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; + }; + luarocks = callPackage ../development/tools/misc/luarocks { inherit lua; };