about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVladimír Čunát <v@cunat.cz>2019-05-01 11:19:49 +0200
committerVladimír Čunát <v@cunat.cz>2019-05-01 11:28:47 +0200
commit110fb944f11f6ee2c9bee661fc125abd68c26db8 (patch)
tree1840b0b7b8a4a9ed24f9d02b3fe7c9c1623c6114
parent90f816174597f4220652ff1b4cc10271978a49c2 (diff)
downloadnixlib-110fb944f11f6ee2c9bee661fc125abd68c26db8.tar
nixlib-110fb944f11f6ee2c9bee661fc125abd68c26db8.tar.gz
nixlib-110fb944f11f6ee2c9bee661fc125abd68c26db8.tar.bz2
nixlib-110fb944f11f6ee2c9bee661fc125abd68c26db8.tar.lz
nixlib-110fb944f11f6ee2c9bee661fc125abd68c26db8.tar.xz
nixlib-110fb944f11f6ee2c9bee661fc125abd68c26db8.tar.zst
nixlib-110fb944f11f6ee2c9bee661fc125abd68c26db8.zip
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.
-rw-r--r--maintainers/scripts/luarocks-packages.csv1
-rw-r--r--pkgs/development/lua-modules/generated-packages.nix20
-rw-r--r--pkgs/development/lua-modules/overrides.nix17
-rw-r--r--pkgs/servers/dns/knot-resolver/default.nix22
-rw-r--r--pkgs/top-level/lua-packages.nix32
5 files changed, 48 insertions, 44 deletions
diff --git a/maintainers/scripts/luarocks-packages.csv b/maintainers/scripts/luarocks-packages.csv
index 284660934f62..fd9ba0edc02b 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 10e249f6a93f..77646b8c3147 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 50310a39f741..c88f5f9f57ca 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 3882db1124a5..15f6be1fa595 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 =  [
+wrapped-full = runCommand unwrapped.name
+  {
+    nativeBuildInputs = [ makeWrapper ];
+    buildInputs = with luajitPackages; [
       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
+      http # for http module; brings lots of deps; some are useful elsewhere
     ];
-  in runCommand unwrapped.name
-  {
-    nativeBuildInputs = [ makeWrapper ];
     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 83ff1d22e5ec..c26f031a0893 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}";