From 811f95f000d9610bd85cca1cf78ae9a069464d87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Baylac-Jacqu=C3=A9?= Date: Fri, 22 Apr 2022 12:50:43 +0200 Subject: [PATCH 1/5] luaPackages.luaunbound: init at 1.0.0-1 Required for Prosody 0.12.0. I first tried to run the bare ./maintainers/scripts/update-luarocks-packages, however it did break a fair share of Lua packages. In the end, I: 1. Added the luaunbound entry to luarocks-packages.csv 2. Run the update-luprocks-packages. 3. Cherry picked the luaunbound entry 4. Reverted the rest of lua-modules/generated-packages.nix to what we currently have in Nixpkgs. 5. Injected the native unbound library via the lua-modules overrides. --- maintainers/scripts/luarocks-packages.csv | 1 + .../lua-modules/generated-packages.nix | 25 +++++++++++++++++++ pkgs/development/lua-modules/overrides.nix | 6 +++++ 3 files changed, 32 insertions(+) diff --git a/maintainers/scripts/luarocks-packages.csv b/maintainers/scripts/luarocks-packages.csv index bdda8020a3d..2d903430520 100644 --- a/maintainers/scripts/luarocks-packages.csv +++ b/maintainers/scripts/luarocks-packages.csv @@ -64,6 +64,7 @@ luasocket,,,,,, luasql-sqlite3,,,,,,vyp luassert,,,,,, luasystem,,,,,, +luaunbound,,,,, luautf8,,,,,,pstn luazip,,,,,, lua-yajl,,,,,,pstn diff --git a/pkgs/development/lua-modules/generated-packages.nix b/pkgs/development/lua-modules/generated-packages.nix index 4269d7eb0d7..75c4426732d 100644 --- a/pkgs/development/lua-modules/generated-packages.nix +++ b/pkgs/development/lua-modules/generated-packages.nix @@ -1944,6 +1944,31 @@ buildLuarocksPackage { }; }) {}; +luaunbound = callPackage({ buildLuarocksPackage, luaOlder, luaAtLeast +, fetchurl, lua +}: +buildLuarocksPackage { + pname = "luaunbound"; + version = "1.0.0-1"; + knownRockspec = (fetchurl { + url = "https://luarocks.org/luaunbound-1.0.0-1.rockspec"; + sha256 = "1zlkibdwrj5p97nhs33cz8xx0323z3kiq5x7v0h3i7v6j0h8ppvn"; + }).outPath; + src = fetchurl { + url = "https://code.zash.se/dl/luaunbound/luaunbound-1.0.0.tar.gz"; + sha256 = "1lsh0ylp5xskygxl5qdv6mhkm1x8xp0vfd5prk5hxkr19jk5mr3d"; + }; + + disabled = with lua; (luaOlder "5.1") || (luaAtLeast "5.5"); + propagatedBuildInputs = [ lua ]; + + meta = { + homepage = "https://www.zash.se/luaunbound.html"; + description = "A binding to libunbound"; + license.fullName = "MIT"; + }; +}) {}; + luautf8 = callPackage({ buildLuarocksPackage, luaOlder, luaAtLeast , fetchurl, lua }: diff --git a/pkgs/development/lua-modules/overrides.nix b/pkgs/development/lua-modules/overrides.nix index b659bd9382a..b2d239774c7 100644 --- a/pkgs/development/lua-modules/overrides.nix +++ b/pkgs/development/lua-modules/overrides.nix @@ -257,6 +257,12 @@ with prev; ]; }); + luaunbound = prev.lib.overrideLuarocks prev.luaunbound(drv: { + externalDeps = [ + { name = "libunbound"; dep = pkgs.unbound; } + ]; + }); + luuid = (prev.lib.overrideLuarocks prev.luuid (drv: { externalDeps = [ { name = "LIBUUID"; dep = pkgs.libuuid; } From 0e630462da8c2e83b6d04eb935353d1e34549c32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Baylac-Jacqu=C3=A9?= Date: Fri, 22 Apr 2022 16:12:26 +0200 Subject: [PATCH 2/5] nixosTests.prosody: fix test The last slixmpp bump revealed a bug in the upstream codebase. I opened a MR upstream, let's patch slixmpp in Nixpkgs until the patch gets merged upstream. Note. I can't directly apply the upstream patch: the pypi release lacks the integration tests directory for some reason. I had to manually butcher the patch and remove the part modifying the integration test. --- ...w-extra-args-in-get_info_from_domain.patch | 36 +++++++++++++++++++ .../python-modules/slixmpp/default.nix | 2 ++ 2 files changed, 38 insertions(+) create mode 100644 pkgs/development/python-modules/slixmpp/0001-xep_0030-allow-extra-args-in-get_info_from_domain.patch diff --git a/pkgs/development/python-modules/slixmpp/0001-xep_0030-allow-extra-args-in-get_info_from_domain.patch b/pkgs/development/python-modules/slixmpp/0001-xep_0030-allow-extra-args-in-get_info_from_domain.patch new file mode 100644 index 00000000000..3f73ab91e3a --- /dev/null +++ b/pkgs/development/python-modules/slixmpp/0001-xep_0030-allow-extra-args-in-get_info_from_domain.patch @@ -0,0 +1,36 @@ +From 7b5ac168892dedc5bd6be4244b18dc32d37d00fd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?F=C3=A9lix=20Baylac-Jacqu=C3=A9?= +Date: Fri, 22 Apr 2022 15:26:05 +0200 +Subject: [PATCH] xep_0030: allow extra args in get_info_from_domain + +Aftermath of ea2d851a. + +http_upload from xep_0363 is now forwarding all its extra input args +to get_info_from_domain. Sadly for us, get_info_from_domain won't +accept any extra args passed that way and will yield a "got an +unexpected keyword argument". + +Modifying get_info_from_domain to accept these extra args. + +I hit this bug by passing a timeout_callback argument to http_upload. +Adding this scenario to the relevant integration test. +--- + itests/test_httpupload.py | 1 + + slixmpp/plugins/xep_0030/disco.py | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/slixmpp/plugins/xep_0030/disco.py b/slixmpp/plugins/xep_0030/disco.py +index 37d453aa..9f9a45f2 100644 +--- a/slixmpp/plugins/xep_0030/disco.py ++++ b/slixmpp/plugins/xep_0030/disco.py +@@ -307,7 +307,7 @@ class XEP_0030(BasePlugin): + return self.api['has_identity'](jid, node, ifrom, data) + + async def get_info_from_domain(self, domain=None, timeout=None, +- cached=True, callback=None): ++ cached=True, callback=None, **iqkwargs): + """Fetch disco#info of specified domain and one disco#items level below + """ + +-- +2.35.1 diff --git a/pkgs/development/python-modules/slixmpp/default.nix b/pkgs/development/python-modules/slixmpp/default.nix index 375f910e5f8..30bdd8b31ff 100644 --- a/pkgs/development/python-modules/slixmpp/default.nix +++ b/pkgs/development/python-modules/slixmpp/default.nix @@ -39,6 +39,8 @@ buildPythonPackage rec { src = ./hardcode-gnupg-path.patch; inherit gnupg; }) + # Upstream MR: https://lab.louiz.org/poezio/slixmpp/-/merge_requests/198 + ./0001-xep_0030-allow-extra-args-in-get_info_from_domain.patch ]; disabledTestPaths = [ From 20693a1e733dca4cd7e3001d7d7f60bd7237b301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Baylac-Jacqu=C3=A9?= Date: Fri, 22 Apr 2022 11:27:51 +0200 Subject: [PATCH 3/5] prosody: 0.11.13 -> 0.12.0 See https://blog.prosody.im/prosody-0.12.0-released for more informations. We remove the various lua wrappers introduced by 6799a9184336146467eb71298d6b18ba7f45e0dc and 16d0b4a69f94adb523da8732b231b0d1738bd713. It seems like we don't need them anymore. I'm not brave enough to dig into the Lua machinery to see what resolved that. Sorry, you'll have to trust me on that one. We should probably think about the migration from http_upload to http_file_share for the NixOS module. It's not trivial, we need to make sure we don't break the already uploaded URLs. --- nixos/modules/services/networking/prosody.nix | 1 + pkgs/servers/xmpp/prosody/default.nix | 29 +++++-------------- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/nixos/modules/services/networking/prosody.nix b/nixos/modules/services/networking/prosody.nix index 42596ccfefd..7920e4b2634 100644 --- a/nixos/modules/services/networking/prosody.nix +++ b/nixos/modules/services/networking/prosody.nix @@ -820,6 +820,7 @@ in '') cfg.muc} ${ lib.optionalString (cfg.uploadHttp != null) '' + -- TODO: think about migrating this to mod-http_file_share instead. Component ${toLua cfg.uploadHttp.domain} "http_upload" http_upload_file_size_limit = ${cfg.uploadHttp.uploadFileSizeLimit} http_upload_expire_after = ${cfg.uploadHttp.uploadExpireAfter} diff --git a/pkgs/servers/xmpp/prosody/default.nix b/pkgs/servers/xmpp/prosody/default.nix index 6b70c4cc987..0d00e48f48a 100644 --- a/pkgs/servers/xmpp/prosody/default.nix +++ b/pkgs/servers/xmpp/prosody/default.nix @@ -1,4 +1,5 @@ { stdenv, fetchurl, lib, libidn, openssl, makeWrapper, fetchhg +, icu , lua , nixosTests , withLibevent ? true @@ -13,7 +14,7 @@ with lib; let luaEnv = lua.withPackages(p: with p; [ - luasocket luasec luaexpat luafilesystem luabitop luadbi-sqlite3 + luasocket luasec luaexpat luafilesystem luabitop luadbi-sqlite3 luaunbound ] ++ lib.optional withLibevent p.luaevent ++ lib.optional withDBI p.luadbi @@ -21,21 +22,19 @@ let ); in stdenv.mkDerivation rec { - version = "0.11.13"; # also update communityModules + version = "0.12.0"; # also update communityModules pname = "prosody"; # The following community modules are necessary for the nixos module # prosody module to comply with XEP-0423 and provide a working # default setup. nixosModuleDeps = [ - "bookmarks" "cloud_notify" "vcard_muc" - "smacks" "http_upload" ]; src = fetchurl { url = "https://prosody.im/downloads/source/${pname}-${version}.tar.gz"; - sha256 = "sha256-OcYbNGoJtRJbYEy5aeFCBsu8uGyBFW/8a6LWJSfPBDI="; + sha256 = "sha256-dS/zIBXaxWX8NBfCGWryaJccNY7gZuUfXZEkE1gNiJo="; }; # A note to all those merging automated updates: Please also update this @@ -43,13 +42,13 @@ stdenv.mkDerivation rec { # version. communityModules = fetchhg { url = "https://hg.prosody.im/prosody-modules"; - rev = "54fa2116bbf3"; - sha256 = "sha256-OKZ7tD75q8/GMXruUQ+r9l0BxzdbPHNf41fZ3fHVQVw="; + rev = "65438e4ba563"; + sha256 = "sha256-zHOrMzcgHOdBl7nObM+OauifbcmKEOfAuj81MDSoLMk="; }; nativeBuildInputs = [ makeWrapper ]; buildInputs = [ - luaEnv libidn openssl + luaEnv libidn openssl icu ] ++ withExtraLibs; @@ -63,26 +62,14 @@ stdenv.mkDerivation rec { make -C tools/migration ''; - luaEnvPath = lua.pkgs.lib.genLuaPathAbsStr luaEnv; - luaEnvCPath = lua.pkgs.lib.genLuaCPathAbsStr luaEnv; - # the wrapping should go away once lua hook is fixed postInstall = '' ${concatMapStringsSep "\n" (module: '' cp -r $communityModules/mod_${module} $out/lib/prosody/modules/ '') (lib.lists.unique(nixosModuleDeps ++ withCommunityModules ++ withOnlyInstalledCommunityModules))} - wrapProgram $out/bin/prosody \ - --prefix LUA_PATH ';' "$luaEnvPath" \ - --prefix LUA_CPATH ';' "$luaEnvCPath" wrapProgram $out/bin/prosodyctl \ - --add-flags '--config "/etc/prosody/prosody.cfg.lua"' \ - --prefix LUA_PATH ';' "$luaEnvPath" \ - --prefix LUA_CPATH ';' "$luaEnvCPath" - + --add-flags '--config "/etc/prosody/prosody.cfg.lua"' make -C tools/migration install - wrapProgram $out/bin/prosody-migrator \ - --prefix LUA_PATH ';' "$luaEnvPath" \ - --prefix LUA_CPATH ';' "$luaEnvCPath" ''; passthru = { From 788ac72c7859e27d5800cddb9ee343248f0b3568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Baylac-Jacqu=C3=A9?= Date: Fri, 22 Apr 2022 16:33:38 +0200 Subject: [PATCH 4/5] nixosTests.prosody: remove explicit timeout_callback error path Slixmpp is yielding a IqTimeout error when timeout is reached. This exception should be catched by the catchall exept clause. Removing the useless timeout_callback function. Kudos to https://lab.louiz.org/poezio/slixmpp/-/merge_requests/198#note_16939 for that one. --- nixos/tests/xmpp/xmpp-sendmessage.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/nixos/tests/xmpp/xmpp-sendmessage.nix b/nixos/tests/xmpp/xmpp-sendmessage.nix index 47a77f524c6..80dfcff2d0e 100644 --- a/nixos/tests/xmpp/xmpp-sendmessage.nix +++ b/nixos/tests/xmpp/xmpp-sendmessage.nix @@ -51,11 +51,8 @@ class CthonTest(ClientXMPP): log.info('Message sent') # Test http upload (XEP_0363) - def timeout_callback(arg): - log.error("ERROR: Cannot upload file. XEP_0363 seems broken") - sys.exit(1) try: - url = await self['xep_0363'].upload_file("${dummyFile}",timeout=10, timeout_callback=timeout_callback) + url = await self['xep_0363'].upload_file("${dummyFile}",timeout=10) except: log.error("ERROR: Cannot run upload command. XEP_0363 seems broken") sys.exit(1) From 23b12701a4b05af2bdb148c928003c74b5dc35f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Baylac-Jacqu=C3=A9?= Date: Mon, 2 May 2022 12:42:41 +0200 Subject: [PATCH 5/5] prosody: remove ninjatrappeur from maintainers I give up on that one. --- pkgs/servers/xmpp/prosody/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/servers/xmpp/prosody/default.nix b/pkgs/servers/xmpp/prosody/default.nix index 0d00e48f48a..607a9dc0201 100644 --- a/pkgs/servers/xmpp/prosody/default.nix +++ b/pkgs/servers/xmpp/prosody/default.nix @@ -82,6 +82,6 @@ stdenv.mkDerivation rec { license = licenses.mit; homepage = "https://prosody.im"; platforms = platforms.linux; - maintainers = with maintainers; [ fpletz globin ninjatrappeur ]; + maintainers = with maintainers; [ fpletz globin ]; }; }