From 721ac05080812b5763f46a4711ff59a32b480ce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Wed, 10 Jul 2024 00:29:15 -0700 Subject: [PATCH] onionshare: fix python 3.12 compatibility, use pkgs.callPackage --- .../networking/onionshare/default.nix | 52 +++++++++---------- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/pkgs/applications/networking/onionshare/default.nix b/pkgs/applications/networking/onionshare/default.nix index 49ce4fae1217..309bfc185aca 100644 --- a/pkgs/applications/networking/onionshare/default.nix +++ b/pkgs/applications/networking/onionshare/default.nix @@ -1,41 +1,25 @@ { lib , stdenv -, buildPythonApplication -, colorama , fetchFromGitHub , fetchpatch -, flask -, flask-compress -, flask-socketio -, gevent-websocket , obfs4 -, psutil -, packaging -, pycrypto -, pynacl -, pyside6 -, pysocks -, pytestCheckHook -, qrcode +, python3 , qt5 -, requests , snowflake -, stem , substituteAll , tor -, unidecode -, waitress -, werkzeug }: let version = "2.6.2"; + src = fetchFromGitHub { owner = "onionshare"; repo = "onionshare"; rev = "v${version}"; hash = "sha256-J8Hdriy8eWpHuMCI87a9a/zCR6xafM3A/Tkyom0Ktko="; }; + meta = with lib; { description = "Securely and anonymously send and receive files"; longDescription = '' @@ -63,10 +47,9 @@ let # TODO: package meek https://support.torproject.org/glossary/meek/ meek = "/meek-not-available"; - in rec { - onionshare = buildPythonApplication { + onionshare = python3.pkgs.buildPythonApplication { pname = "onionshare-cli"; inherit version; src = "${src}/cli"; @@ -77,8 +60,17 @@ rec { inherit tor meek obfs4 snowflake; inherit (tor) geoip; }) + + # Remove distutils for Python 3.12 compatibility + # https://github.com/onionshare/onionshare/pull/1907 + (fetchpatch { + url = "https://github.com/onionshare/onionshare/commit/1fb1a470df20d8a7576c8cf51213e5928528d59a.patch"; + includes = [ "onionshare_cli/onion.py" ]; + stripLen = 1; + hash = "sha256-4XkqaEhMhvj6PyMssnLfXRazdP4k+c9mMDveho7pWg8="; + }) ]; - propagatedBuildInputs = [ + dependencies = with python3.pkgs; [ colorama flask flask-compress @@ -91,7 +83,6 @@ rec { pyside6 pysocks qrcode - qrcode requests stem unidecode @@ -104,7 +95,7 @@ rec { tor ]; - nativeCheckInputs = [ + nativeCheckInputs = with python3.pkgs; [ pytestCheckHook ]; @@ -129,7 +120,7 @@ rec { }; }; - onionshare-gui = buildPythonApplication { + onionshare-gui = python3.pkgs.buildPythonApplication { pname = "onionshare"; inherit version; src = "${src}/desktop"; @@ -147,9 +138,18 @@ rec { stripLen = 1; hash = "sha256-wfIjdPhdUYAvbK5XyE1o2OtFOlJRj0X5mh7QQRjdyP0="; }) + + # Remove distutils for Python 3.12 compatibility + # https://github.com/onionshare/onionshare/pull/1907 + (fetchpatch { + url = "https://github.com/onionshare/onionshare/commit/1fb1a470df20d8a7576c8cf51213e5928528d59a.patch"; + includes = [ "onionshare/update_checker.py" ]; + stripLen = 1; + hash = "sha256-mRRj9cALZVHw86CgU17sp9EglKhkRRcGfROyQpsXVfU="; + }) ]; - propagatedBuildInputs = [ + dependencies = with python3.pkgs; [ onionshare pyside6 qrcode diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 12c48c9586da..29619cfcac57 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -33119,7 +33119,7 @@ with pkgs; omxplayer = callPackage ../applications/video/omxplayer { }; - inherit (python3Packages.callPackage ../applications/networking/onionshare { }) onionshare onionshare-gui; + inherit (callPackage ../applications/networking/onionshare { }) onionshare onionshare-gui; openambit = qt5.callPackage ../applications/misc/openambit { };