From 110fb944f11f6ee2c9bee661fc125abd68c26db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Wed, 1 May 2019 11:19:49 +0200 Subject: [PATCH] lua*Packages.http: 0.3 -> 0.4 (and generate) One bugfix patch is included - merged upstream but not released yet. knot-resolver wrapper would need to add binaryheap explicitly, so it's migrated to the automatic LUA path discovery instead. --- maintainers/scripts/luarocks-packages.csv | 1 + .../lua-modules/generated-packages.nix | 20 ++++++++++++ pkgs/development/lua-modules/overrides.nix | 17 ++++++++++ pkgs/servers/dns/knot-resolver/default.nix | 24 +++++++------- pkgs/top-level/lua-packages.nix | 32 ------------------- 5 files changed, 49 insertions(+), 45 deletions(-) diff --git a/maintainers/scripts/luarocks-packages.csv b/maintainers/scripts/luarocks-packages.csv index 284660934f6..fd9ba0edc02 100644 --- a/maintainers/scripts/luarocks-packages.csv +++ b/maintainers/scripts/luarocks-packages.csv @@ -5,6 +5,7 @@ basexx, binaryheap, dkjson fifo +http inspect lgi lpeg_patterns diff --git a/pkgs/development/lua-modules/generated-packages.nix b/pkgs/development/lua-modules/generated-packages.nix index 10e249f6a93..77646b8c314 100644 --- a/pkgs/development/lua-modules/generated-packages.nix +++ b/pkgs/development/lua-modules/generated-packages.nix @@ -130,6 +130,26 @@ fifo = buildLuarocksPackage { }; }; }; +http = buildLuarocksPackage { + pname = "http"; + version = "0.3-0"; + + src = fetchurl { + url = https://luarocks.org/http-0.3-0.src.rock; + sha256 = "0vvl687bh3cvjjwbyp9cphqqccm3slv4g7y3h03scp3vpq9q4ccq"; + }; + disabled = ( luaOlder "5.1"); + propagatedBuildInputs = [ lua compat53 bit32 cqueues luaossl basexx lpeg lpeg_patterns binaryheap fifo ]; + buildType = "builtin"; + + meta = { + homepage = "https://github.com/daurnimator/lua-http"; + description="HTTP library for Lua"; + license = { + fullName = "MIT"; + }; + }; +}; inspect = buildLuarocksPackage { pname = "inspect"; version = "3.1.1-0"; diff --git a/pkgs/development/lua-modules/overrides.nix b/pkgs/development/lua-modules/overrides.nix index 50310a39f74..c88f5f9f57c 100644 --- a/pkgs/development/lua-modules/overrides.nix +++ b/pkgs/development/lua-modules/overrides.nix @@ -81,4 +81,21 @@ with super; maintainers = with pkgs.lib.maintainers; oa.meta.maintainers ++ [ vcunat ]; }; }); + + http = super.http.overrideAttrs(oa: { + patches = oa.patches or [] ++ [ + (pkgs.fetchpatch { + name = "invalid-state-progression.patch"; + url = "https://github.com/daurnimator/lua-http/commit/cb7b59474a.diff"; + sha256 = "1vmx039n3nqfx50faqhs3wgiw28ws416rhw6vh6srmh9i826dac7"; + }) + ]; + /* TODO: separate docs derivation? (pandoc is heavy) + nativeBuildInputs = [ pandoc ]; + makeFlags = [ "-C doc" "lua-http.html" "lua-http.3" ]; + */ + meta = oa.meta // { + maintainers = with pkgs.lib.maintainers; oa.meta.maintainers ++ [ vcunat ]; + }; + }); } diff --git a/pkgs/servers/dns/knot-resolver/default.nix b/pkgs/servers/dns/knot-resolver/default.nix index 3882db1124a..15f6be1fa59 100644 --- a/pkgs/servers/dns/knot-resolver/default.nix +++ b/pkgs/servers/dns/knot-resolver/default.nix @@ -75,26 +75,24 @@ unwrapped = stdenv.mkDerivation rec { }; }; -wrapped-full = with luajitPackages; let - luaPkgs = [ - luasec luasocket # trust anchor bootstrap, prefill module - lfs # prefill module - # Almost all is for the 'http' module: - http cqueues fifo lpeg lpeg_patterns luaossl compat53 basexx - ]; - in runCommand unwrapped.name +wrapped-full = runCommand unwrapped.name { nativeBuildInputs = [ makeWrapper ]; + buildInputs = with luajitPackages; [ + luasec luasocket # trust anchor bootstrap, prefill module + lfs # prefill module + http # for http module; brings lots of deps; some are useful elsewhere + ]; preferLocalBuild = true; allowSubstitutes = false; } '' - mkdir -p "$out/sbin" "$out/share" - makeWrapper '${unwrapped}/sbin/kresd' "$out"/sbin/kresd \ - --set LUA_PATH '${concatStringsSep ";" (map getLuaPath luaPkgs)}' \ - --set LUA_CPATH '${concatStringsSep ";" (map getLuaCPath luaPkgs)}' + mkdir -p "$out"/{bin,share} + makeWrapper '${unwrapped}/bin/kresd' "$out"/bin/kresd \ + --set LUA_PATH "$LUA_PATH" \ + --set LUA_CPATH "$LUA_CPATH" ln -sr '${unwrapped}/share/man' "$out"/share/ - ln -sr "$out"/{sbin,bin} + ln -sr "$out"/{bin,sbin} ''; in result diff --git a/pkgs/top-level/lua-packages.nix b/pkgs/top-level/lua-packages.nix index 83ff1d22e5e..c26f031a089 100644 --- a/pkgs/top-level/lua-packages.nix +++ b/pkgs/top-level/lua-packages.nix @@ -193,38 +193,6 @@ with self; { }; }; - http = buildLuaPackage rec { - version = "0.2"; - name = "http-${version}"; - - src = fetchFromGitHub { - owner = "daurnimator"; - repo = "lua-http"; - rev = "v${version}"; - sha256 = "0a8vsj49alaf1fkhv51n5mgpjq8izfff3shcjs8xk7p2bc46vd7i"; - }; - - /* TODO: separate docs derivation? (pandoc is heavy) - nativeBuildInputs = [ pandoc ]; - makeFlags = [ "-C doc" "lua-http.html" "lua-http.3" ]; - */ - - buildPhase = ":"; - installPhase = '' - install -Dt "$out/lib/lua/${lua.luaversion}/http" \ - http/*.lua - install -Dt "$out/lib/lua/${lua.luaversion}/http/compat" \ - http/compat/*.lua - ''; - - meta = with stdenv.lib; { - description = "HTTP library for lua"; - homepage = "https://daurnimator.github.io/lua-http/${version}/"; - license = licenses.mit; - maintainers = with maintainers; [ vcunat ]; - }; - }; - luacyrussasl = buildLuaPackage rec { version = "1.1.0"; name = "lua-cyrussasl-${version}";