From c37b8925ba6d1b23a892f99b8634c5b5f51f1688 Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Thu, 7 Mar 2019 16:58:06 +0900 Subject: [PATCH 1/3] luarocks: 2.4.4 -> 3.0.4 Some new features like test_dependencies/build_dependencies and flags ( --lua-versions) that should make nix integration easier: https://github.com/luarocks/luarocks/blob/master/CHANGELOG.md --- .../tools/misc/luarocks/darwin.patch | 50 +++++++++---------- .../tools/misc/luarocks/default.nix | 9 ++-- 2 files changed, 28 insertions(+), 31 deletions(-) diff --git a/pkgs/development/tools/misc/luarocks/darwin.patch b/pkgs/development/tools/misc/luarocks/darwin.patch index ec7f924987a..a5e4ac461b4 100644 --- a/pkgs/development/tools/misc/luarocks/darwin.patch +++ b/pkgs/development/tools/misc/luarocks/darwin.patch @@ -1,27 +1,27 @@ -diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua -index 55cd4c9..060a6f1 100644 ---- a/src/luarocks/cfg.lua -+++ b/src/luarocks/cfg.lua -@@ -587,9 +587,9 @@ if cfg.platforms.macosx then - defaults.external_lib_extension = "dylib" - defaults.arch = "macosx-"..cfg.target_cpu - defaults.variables.LIBFLAG = "-bundle -undefined dynamic_lookup -all_load" -- defaults.variables.STAT = "/usr/bin/stat" -+ defaults.variables.STAT = "stat" - defaults.variables.STATFLAG = "-f '%A'" -- local version = io.popen("sw_vers -productVersion"):read("*l") -+ local version = "10.10" - version = tonumber(version and version:match("^[^.]+%.([^.]+)")) or 3 - if version >= 10 then - version = 8 -@@ -598,8 +598,8 @@ if cfg.platforms.macosx then - else - defaults.gcc_rpath = false +diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua +index f93e67a..2eb2db9 100644 +--- a/src/luarocks/core/cfg.lua ++++ b/src/luarocks/core/cfg.lua +@@ -425,9 +425,9 @@ 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" +- defaults.variables.STAT = "/usr/bin/stat" ++ defaults.variables.STAT = "stat" + defaults.variables.STATFLAG = "-f '%A'" +- 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 +@@ -436,8 +436,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 -- 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 diff --git a/pkgs/development/tools/misc/luarocks/default.nix b/pkgs/development/tools/misc/luarocks/default.nix index 5e418fcfdcf..7edcb79388a 100644 --- a/pkgs/development/tools/misc/luarocks/default.nix +++ b/pkgs/development/tools/misc/luarocks/default.nix @@ -7,16 +7,13 @@ , cmake }: -let -in - stdenv.mkDerivation rec { - pname="luarocks"; - version="2.4.4"; + pname = "luarocks"; + version = "3.0.4"; src = fetchurl { url="http://luarocks.org/releases/luarocks-${version}.tar.gz"; - sha256="0d7rl60dwh52qh5pfsphgx5ypp7k190h9ri6qpr2yx9kvqrxyf1r"; + sha256="1pqfzwvjy8dzqg4fqjq2cgqcr00fgrdd7nwzxm7nqmawr83s6dhj"; }; patches = [ ./darwin.patch ]; From 68a72f1a478b0dd09f0105d460e7e1a28bbc4560 Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Thu, 7 Mar 2019 16:58:54 +0900 Subject: [PATCH 2/3] luarocks-nix: bump to match luarocks Also made changes to lua package generation system to account for packages like cqueues that have one version per lua interpreter. The csv file also accepts comments now. --- maintainers/scripts/luarocks-packages.csv | 15 ++++++----- maintainers/scripts/update-luarocks-packages | 26 ++++++++++++------- .../tools/misc/luarocks/luarocks-nix.nix | 5 ++-- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/maintainers/scripts/luarocks-packages.csv b/maintainers/scripts/luarocks-packages.csv index f5998f010d8..035a0d891cc 100644 --- a/maintainers/scripts/luarocks-packages.csv +++ b/maintainers/scripts/luarocks-packages.csv @@ -1,3 +1,4 @@ +# nix name, luarocks name, server, version/additionnal args ansicolors, argparse, basexx, @@ -17,15 +18,15 @@ lua-term, luabitop, luaevent, luacheck -luaffi,http://luarocks.org/dev, +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 +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 index 171b49ee568..4b94343233e 100755 --- a/maintainers/scripts/update-luarocks-packages +++ b/maintainers/scripts/update-luarocks-packages @@ -74,17 +74,18 @@ FOOTER=" function convert_pkg () { - pkg="$1" + nix_pkg_name="$1" + lua_pkg_name="$2" server="" - if [ ! -z "$2" ]; then - server=" --server=$2" + if [ ! -z "$3" ]; then + server=" --server=$3" fi version="${3:-}" - echo "looking at $pkg (version $version) from server [$server]" >&2 - cmd="luarocks nix $server $pkg $version" - drv="$($cmd)" + echo "looking at $lua_pkg_name (version $version) from server [$server]" >&2 + cmd="luarocks nix $server $lua_pkg_name $version" + drv="$nix_pkg_name = $($cmd)" if [ $? -ne 0 ]; then echo "Failed to convert $pkg" >&2 echo "$drv" >&2 @@ -98,12 +99,17 @@ echo "$HEADER" | tee "$TMP_FILE" # list of packages with format # name,server,version -while IFS=, read -r pkg_name server version +while IFS=, read -r nix_pkg_name lua_pkg_name server version do - if [ -z "$pkg_name" ]; then - echo "Skipping empty package name" >&2 + if [ "${nix_pkg_name:0:1}" == "#" ]; then + echo "Skipping comment ${nix_pkg_name}" >&2 + continue fi - convert_pkg "$pkg_name" "$server" "$version" + 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" "$version" done < "$CSV_FILE" # close the set diff --git a/pkgs/development/tools/misc/luarocks/luarocks-nix.nix b/pkgs/development/tools/misc/luarocks/luarocks-nix.nix index a918cb0c647..7dc0809c887 100644 --- a/pkgs/development/tools/misc/luarocks/luarocks-nix.nix +++ b/pkgs/development/tools/misc/luarocks/luarocks-nix.nix @@ -1,9 +1,10 @@ { luarocks, fetchFromGitHub }: luarocks.overrideAttrs(old: { + pname = "luarocks-nix"; src = fetchFromGitHub { owner = "teto"; repo = "luarocks"; - rev = "f9dc7892214bff6bce822d94aca3331048e61df0"; - sha256 = "117qqbiv87p2qw0zwapl7b0p4wgnn9f8k0qpppkj3653a1bwli05"; + rev = "8fb03a9bc8f4fa079d26c0f02804139bb2578848"; + sha256 = "09iwjvs9sbk6vwhrh7sijmfpji6wvg5bbdraw7l5lpnr9jj5wy91"; }; }) From 64801cc1533a2429c9fc3e34782c0f5d54a6693a Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Thu, 7 Mar 2019 15:09:33 +0900 Subject: [PATCH 3/3] lua-packages.nix:remove unused 'overrides' setting This was leftover from early implementations. The overrides are passed via packageOverrides in lua-modules/default.nix --- pkgs/top-level/lua-packages.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/top-level/lua-packages.nix b/pkgs/top-level/lua-packages.nix index 2899e91ceb6..9aa08b16115 100644 --- a/pkgs/top-level/lua-packages.nix +++ b/pkgs/top-level/lua-packages.nix @@ -12,7 +12,6 @@ , fetchFromGitHub, libmpack, which, fetchpatch, writeText , pkgs , fetchgit -, overrides ? (self: super: {}) , lib }: @@ -867,4 +866,4 @@ with self; { }); }); -in (lib.extends overrides packages) +in packages