diff --git a/maintainers/scripts/luarocks-packages.csv b/maintainers/scripts/luarocks-packages.csv index 7074a650e067..a7989c74b21a 100644 --- a/maintainers/scripts/luarocks-packages.csv +++ b/maintainers/scripts/luarocks-packages.csv @@ -2,8 +2,10 @@ ansicolors, argparse, basexx, +binaryheap, dkjson fifo +http inspect ldoc lgi diff --git a/pkgs/development/lua-modules/generated-packages.nix b/pkgs/development/lua-modules/generated-packages.nix index a1f7a2096e57..e13f6a4d96e7 100644 --- a/pkgs/development/lua-modules/generated-packages.nix +++ b/pkgs/development/lua-modules/generated-packages.nix @@ -76,6 +76,26 @@ basexx = buildLuarocksPackage { }; }; }; +binaryheap = buildLuarocksPackage { + pname = "binaryheap"; + version = "0.4-1"; + + src = fetchurl { + url = https://luarocks.org/binaryheap-0.4-1.src.rock; + sha256 = "11rd8r3bpinfla2965jgjdv1hilqdc1q6g1qla5978d7vzg19kpc"; + }; + disabled = ( luaOlder "5.1"); + propagatedBuildInputs = [ lua ]; + buildType = "builtin"; + + meta = { + homepage = "https://github.com/Tieske/binaryheap.lua"; + description="Binary heap implementation in pure Lua"; + license = { + fullName = "MIT/X11"; + }; + }; +}; dkjson = buildLuarocksPackage { pname = "dkjson"; version = "2.5-2"; @@ -116,6 +136,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 0cf0c70faa10..c88f5f9f57ca 100644 --- a/pkgs/development/lua-modules/overrides.nix +++ b/pkgs/development/lua-modules/overrides.nix @@ -56,7 +56,7 @@ with super; ''; }); - luuid = super.luuid.override({ + luuid = super.luuid.override(oa: { buildInputs = [ pkgs.libuuid ]; extraConfig = '' variables = { @@ -64,7 +64,7 @@ with super; LIBUUID_LIBDIR="${pkgs.lib.getLib pkgs.libuuid}/lib"; } ''; - meta = { + meta = oa.meta // { platforms = pkgs.lib.platforms.linux; }; }); @@ -75,4 +75,27 @@ with super; sed -i '/set(CMAKE_C_FLAGS/d' CMakeLists.txt ''; }); - } + + binaryheap = super.binaryheap.overrideAttrs(oa: { + meta = oa.meta // { + 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 = [ - 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 b51af519f938..c26f031a0893 100644 --- a/pkgs/top-level/lua-packages.nix +++ b/pkgs/top-level/lua-packages.nix @@ -151,10 +151,11 @@ with self; { cc lutf8lib.c $CFLAGS -o utf8.so ''; - # There's no need to separate *.lua and *.so, I guess? TODO: conventions? + # The hook in ../development/lua-modules/generic/default.nix + # is strict about share vs. lib for _PATH and _CPATH. installPhase = '' - install -Dt "$out/lib/lua/${lua.luaversion}/compat53" \ - compat53/*.lua *.so + install -Dt "$out/share/lua/${lua.luaversion}/compat53" compat53/*.lua + install -Dt "$out/lib/lua/${lua.luaversion}/compat53" *.so ''; meta = with stdenv.lib; { @@ -192,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}"; @@ -419,12 +388,13 @@ with self; { sha256 = "0wv8l7f7na7kw5xn8mjik2wpxbizl7zvvp5s7fcwvz9kl5jdpk5b"; }; + propagatedBuildInputs = [ luasocket ]; buildInputs = [ openssl ]; preBuild = '' makeFlagsArray=( ${platformString} - LUAPATH="$out/lib/lua/${lua.luaversion}" + LUAPATH="$out/share/lua/${lua.luaversion}" LUACPATH="$out/lib/lua/${lua.luaversion}" INC_PATH="-I${lua}/include" LIB_PATH="-L$out/lib");