From 6d90bc1c110dc4bb06d253210be51ea97633fac9 Mon Sep 17 00:00:00 2001 From: Daniel Olsen Date: Thu, 24 Jun 2021 23:30:36 +0200 Subject: [PATCH 1/4] pythonPackages.txredisapi: init at 1.4.7 --- .../python-modules/txredisapi/default.nix | 26 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 ++ 2 files changed, 28 insertions(+) create mode 100644 pkgs/development/python-modules/txredisapi/default.nix diff --git a/pkgs/development/python-modules/txredisapi/default.nix b/pkgs/development/python-modules/txredisapi/default.nix new file mode 100644 index 000000000000..00da16c040fe --- /dev/null +++ b/pkgs/development/python-modules/txredisapi/default.nix @@ -0,0 +1,26 @@ +{ lib, buildPythonPackage, fetchFromGitHub, nixosTests, six, twisted }: + +buildPythonPackage rec { + pname = "txredisapi"; + version = "1.4.7"; + + src = fetchFromGitHub { + owner = "IlyaSkriblovsky"; + repo = "txredisapi"; + rev = "1.4.7"; + sha256 = "1f7j3c5l7jcfphvsk7nqmgyb4jaydbzq081m555kw0f9xxak0pgq"; + }; + + propagatedBuildInputs = [ six twisted ]; + + doCheck = false; + pythonImportsCheck = [ "txredisapi" ]; + + meta = with lib; { + homepage = "https://github.com/IlyaSkriblovsky/txredisapi"; + description = "non-blocking redis client for python"; + license = licenses.asl20; + maintainers = with maintainers; [ dandellion ]; + }; +} + diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 78cc347ad715..565c2b7898b1 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -8699,6 +8699,8 @@ in { txgithub = callPackage ../development/python-modules/txgithub { }; + txredisapi = callPackage ../development/python-modules/txredisapi { }; + txrequests = callPackage ../development/python-modules/txrequests { }; txtorcon = callPackage ../development/python-modules/txtorcon { }; From f7f52a4fbf9cce72ec5be144ac5e665071f0da61 Mon Sep 17 00:00:00 2001 From: Daniel Olsen Date: Thu, 24 Jun 2021 23:34:03 +0200 Subject: [PATCH 2/4] pythonPackages.txredisapi: Add unit test --- nixos/tests/all-tests.nix | 1 + nixos/tests/txredisapi.nix | 27 +++++++++++++++++++ .../python-modules/txredisapi/default.nix | 2 ++ 3 files changed, 30 insertions(+) create mode 100644 nixos/tests/txredisapi.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index e8c86394831d..a8e06a0cee1e 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -431,6 +431,7 @@ in trezord = handleTest ./trezord.nix {}; trickster = handleTest ./trickster.nix {}; trilium-server = handleTestOn ["x86_64-linux"] ./trilium-server.nix {}; + txredisapi = handleTest ./txredisapi.nix {}; tuptime = handleTest ./tuptime.nix {}; turbovnc-headless-server = handleTest ./turbovnc-headless-server.nix {}; ucarp = handleTest ./ucarp.nix {}; diff --git a/nixos/tests/txredisapi.nix b/nixos/tests/txredisapi.nix new file mode 100644 index 000000000000..bc3814a71375 --- /dev/null +++ b/nixos/tests/txredisapi.nix @@ -0,0 +1,27 @@ +import ./make-test-python.nix ({ pkgs, ... }: +{ + name = "txredisapi"; + meta = with pkgs.lib.maintainers; { + maintainers = [ dandellion ]; + }; + + nodes = { + machine = + { pkgs, ... }: + + { + services.redis.enable = true; + services.redis.unixSocket = "/run/redis/redis.sock"; + + environment.systemPackages = with pkgs; [ (python38.withPackages (ps: [ ps.twisted ps.txredisapi ps.mock ]))]; + }; + }; + + testScript = '' + start_all() + machine.wait_for_unit("redis") + machine.wait_for_open_port("6379") + + tests = machine.succeed("PYTHONPATH=\"${pkgs.python3Packages.txredisapi.src}\" python -m twisted.trial ${pkgs.python3Packages.txredisapi.src}/tests") + ''; +}) diff --git a/pkgs/development/python-modules/txredisapi/default.nix b/pkgs/development/python-modules/txredisapi/default.nix index 00da16c040fe..9d8b268b30b2 100644 --- a/pkgs/development/python-modules/txredisapi/default.nix +++ b/pkgs/development/python-modules/txredisapi/default.nix @@ -16,6 +16,8 @@ buildPythonPackage rec { doCheck = false; pythonImportsCheck = [ "txredisapi" ]; + passthru.tests.unit-tests = nixosTests.txredisapi; + meta = with lib; { homepage = "https://github.com/IlyaSkriblovsky/txredisapi"; description = "non-blocking redis client for python"; From 55e325032b7ae77198715136f51f38ea0fbabbbe Mon Sep 17 00:00:00 2001 From: Daniel Olsen Date: Thu, 24 Jun 2021 23:58:18 +0200 Subject: [PATCH 3/4] matrix-synapse: Add txredisapi as dependency when using redis --- pkgs/servers/matrix-synapse/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/servers/matrix-synapse/default.nix b/pkgs/servers/matrix-synapse/default.nix index c65627311439..1d8c2737b012 100644 --- a/pkgs/servers/matrix-synapse/default.nix +++ b/pkgs/servers/matrix-synapse/default.nix @@ -60,7 +60,7 @@ buildPythonApplication rec { typing-extensions unpaddedbase64 ] ++ lib.optional enableSystemd systemd - ++ lib.optional enableRedis hiredis; + ++ lib.optionals enableRedis [ hiredis txredisapi ]; checkInputs = [ mock parameterized openssl ]; From 44a982a00657ffd7997fd69100c49186d429ce6c Mon Sep 17 00:00:00 2001 From: Daniel Olsen Date: Fri, 25 Jun 2021 00:01:33 +0200 Subject: [PATCH 4/4] maintainers/teams: Add dandellion to matrix team --- maintainers/team-list.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/maintainers/team-list.nix b/maintainers/team-list.nix index 1cfbe7b4b825..ab42a99486aa 100644 --- a/maintainers/team-list.nix +++ b/maintainers/team-list.nix @@ -161,6 +161,7 @@ with lib.maintainers; { ekleog ralith mjlbach + dandellion ]; scope = "Maintain the ecosystem around Matrix, a decentralized messenger."; };