From 15d6cef558238ee0d18a5057f8935799d7b58e1b Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Mon, 21 Jan 2019 19:16:35 +0900 Subject: [PATCH] adding missing files --- doc/languages-frameworks/lua.section.md | 4 +- maintainers/scripts/lua-packages.csv | 44 +++++++++++++++++ ...s-packages.sh => update-luarocks-packages} | 49 +++++++++++-------- .../lua-modules/generated-packages.nix | 2 +- pkgs/top-level/all-packages.nix | 13 +++-- pkgs/top-level/lua-packages.nix | 2 +- 6 files changed, 86 insertions(+), 28 deletions(-) create mode 100644 maintainers/scripts/lua-packages.csv rename maintainers/scripts/{update-luarocks-packages.sh => update-luarocks-packages} (59%) diff --git a/doc/languages-frameworks/lua.section.md b/doc/languages-frameworks/lua.section.md index b511601ea97e8..03ec4dd966aa8 100644 --- a/doc/languages-frameworks/lua.section.md +++ b/doc/languages-frameworks/lua.section.md @@ -119,8 +119,8 @@ Luarocks2nix is a tool capable of generating nix derivations from a rockspec fil upload the file on luarocks.org. 2. nix won't work with all packages. If the package lists `external_dependencies` in its rockspec file then it won't work. -You can run `nix-shell -p luarocks-nix` and then `luarocks convert2nix -PKG_NAME`. Once you have checked the package works without modifications, you can add it to `maintainers/scripts/update-luarocks-packages.sh` +You can run `nix-shell -p luarocks-nix` and then `luarocks nix PKG_NAME`. +Once you have checked the package works without modifications, you can add it to `maintainers/scripts/luarocks.sh` Nix rely on luarocks to install lua packages, basically it runs: `luarocks make --deps-mode=none --tree $out` diff --git a/maintainers/scripts/lua-packages.csv b/maintainers/scripts/lua-packages.csv new file mode 100644 index 0000000000000..eb372451441b6 --- /dev/null +++ b/maintainers/scripts/lua-packages.csv @@ -0,0 +1,44 @@ +ansicolors, +argparse, +basexx, +cqueues +dkjson +fifo +lgi +lpeg_patterns +lpty, +lrexlib-gnu, +lrexlib-posix, +ltermbox, +lua-cjson, +lua-cmsgpack, +lua_cliargs, +lua-iconv, +lua-term, +lua-zlib, +luacheck, +luadbi, +luaexpat, +luaffi,http://luarocks.org/dev, +luaevent, +luabitop, +luasocket, +luafilesystem, +luaposix, +luasec, +luazip, +luuid, +http, +penlight, +say, +std.normalize, +std._debug, +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 +lpeg,https://luarocks.org/manifests/gvvaughan diff --git a/maintainers/scripts/update-luarocks-packages.sh b/maintainers/scripts/update-luarocks-packages similarity index 59% rename from maintainers/scripts/update-luarocks-packages.sh rename to maintainers/scripts/update-luarocks-packages index 20626297a2cd3..9f34ad0964933 100755 --- a/maintainers/scripts/update-luarocks-packages.sh +++ b/maintainers/scripts/update-luarocks-packages @@ -1,11 +1,12 @@ #!/usr/bin/env nix-shell -#!nix-shell -i bash -p lua5_2.withPackages(ps:[ps.luarocks-nix]) nix-prefetch-scripts +#!nix-shell -p nix-prefetch-scripts luarocks-nix -i bash # You'll likely want to use # `` -# nixpkgs $ maintainers/scripts/update-luarocks-packages.sh > pkgs/top-level/lua-generated-packages.nix +# nixpkgs $ maintainers/scripts/update-luarocks-packages.sh > 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 @@ -13,7 +14,7 @@ set -eu -o pipefail if [ $# -lt 1 ]; then echo "Usage: $0 GENERATED_FILENAME" - echo "(most likely pkgs/top-level/lua-generated-packages.nix)" + echo "(most likely pkgs/development/lua-modules/generated-packages.nix)" exit 1 fi @@ -51,21 +52,20 @@ read -d '' -r HEADER <&2 - drv=$(luarocks convert2nix $server "$pkg") - if [ $? -gt 0 ]; then + version="${3:-}" + + set -x + 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 @@ -93,19 +97,24 @@ function convert_pkg () { fi } -# list of packages -source maintainers/scripts/lua_packages.sh +# source maintainers/scripts/lua_packages.sh # params needed when called via callPackage -echo "$HEADER" | tee $TMP_FILE +echo "$HEADER" | tee "$TMP_FILE" -if [ ! -z $PACKAGE ]; then - convert_pkg "$PACKAGE" "${pkg_list[$PACKAGE]}" +if [ ! -z "$PACKAGE" ]; then + convert_pkg "$PACKAGE" else - for pkg_name in "${!pkg_list[@]}"; + # list of packages with format + # name,server,version + while IFS=, read -r pkg_name server version do - convert_pkg $pkg_name "${pkg_list[$pkg_name]}" - done + if [ -z "$pkg_name" ]; then + echo "Skipping empty package name" >&2 + fi + echo "PKG $pkg_name version $version from server $server" >&2 + convert_pkg "$pkg_name" "$server" "$version" + done < maintainers/scripts/lua-packages.csv fi # close the set echo "$FOOTER" | tee -a "$TMP_FILE" diff --git a/pkgs/development/lua-modules/generated-packages.nix b/pkgs/development/lua-modules/generated-packages.nix index 08da6435af84b..119a7b2b79726 100644 --- a/pkgs/development/lua-modules/generated-packages.nix +++ b/pkgs/development/lua-modules/generated-packages.nix @@ -1,6 +1,6 @@ /* pkgs/development/lua-modules/generated-packages.nix is an auto-generated file -- DO NOT EDIT! Regenerate it with: -nixpkgs$ maintainers/scripts/update-luarocks-packages.sh pkgs/development/lua-modules/generated-packages.nix +nixpkgs$ maintainers/scripts/update-luarocks-packages pkgs/development/lua-modules/generated-packages.nix */ { # , lua diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e0980cb28c1e7..64199565385e1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7881,10 +7881,15 @@ in luarocks = luaPackages.luarocks; - # fork that adds the 'convert2nix' command to luarocks - # hopefully it can be installed as an addon once luarocks - # completes addon support - luarocks-nix = luaPackages.luarocks-nix; + # fork that adds the 'nix' command to luarocks + luarocks-nix = luarocks.overrideAttrs(old: { + src = fetchFromGitHub { + owner = "teto"; + repo = "luarocks"; + rev = "d669e8e118e6ca8bff05f32dbc9e5589e6ac45d2"; + sha256 = "1lay3905a5sx2a4y68lbys0913qs210hcj9kn2lbqinw86c1vyc3"; + }; + }); toluapp = callPackage ../development/tools/toluapp { diff --git a/pkgs/top-level/lua-packages.nix b/pkgs/top-level/lua-packages.nix index 3bce347453e02..07838a50d83be 100644 --- a/pkgs/top-level/lua-packages.nix +++ b/pkgs/top-level/lua-packages.nix @@ -29,7 +29,7 @@ let isLuaJIT = (builtins.parseDrvName lua.name).name == "luajit"; # Check whether a derivation provides a lua module. - hasLuaModule = drv: drv? luaModule ; + hasLuaModule = drv: drv ? luaModule ; callPackage = pkgs.newScope self;