diff --git a/pkgs/applications/networking/protonvpn-cli/2.nix b/pkgs/applications/networking/protonvpn-cli/2.nix new file mode 100644 index 00000000000..c3e9bd2ac21 --- /dev/null +++ b/pkgs/applications/networking/protonvpn-cli/2.nix @@ -0,0 +1,51 @@ +{ lib +, buildPythonApplication +, fetchFromGitHub +, pythonOlder +, requests +, docopt +, pythondialog +, jinja2 +, distro +, dialog +, iptables +, openvpn }: + +buildPythonApplication rec { + pname = "protonvpn-cli_2"; + version = "2.2.11"; + format = "setuptools"; + + disabled = pythonOlder "3.5"; + + src = fetchFromGitHub { + owner = "Rafficer"; + repo = "linux-cli-community"; + # There is a tag and branch with the same name + rev = "refs/tags/v${version}"; + sha256 = "sha256-CWQpisJPBXbf+d5tCGuxfSQQZBeF36WFF4b6OSUn3GY="; + }; + + propagatedBuildInputs = [ + requests + docopt + pythondialog + jinja2 + distro + dialog + openvpn + iptables + ]; + + # No tests + doCheck = false; + + meta = with lib; { + description = "Linux command-line client for ProtonVPN using Openvpn"; + homepage = "https://github.com/Rafficer/linux-cli-community"; + maintainers = with maintainers; [ jtcoolen jefflabonte shamilton ]; + license = licenses.gpl3Plus; + platforms = platforms.linux; + mainProgram = "protonvpn"; + }; +} diff --git a/pkgs/applications/networking/protonvpn-cli/default.nix b/pkgs/applications/networking/protonvpn-cli/default.nix index e46909d2a7c..5182b5c256f 100644 --- a/pkgs/applications/networking/protonvpn-cli/default.nix +++ b/pkgs/applications/networking/protonvpn-cli/default.nix @@ -1,37 +1,41 @@ -{ lib, fetchFromGitHub, python3Packages, openvpn, dialog, iptables }: +{ lib +, buildPythonApplication +, pythonOlder +, fetchFromGitHub +, protonvpn-nm-lib +, pythondialog +, dialog +}: -python3Packages.buildPythonApplication rec { - pname = "protonvpn-linux-cli"; - version = "2.2.6"; +buildPythonApplication rec { + pname = "protonvpn-cli"; + version = "3.11.1"; + format = "setuptools"; + + disabled = pythonOlder "3.5"; src = fetchFromGitHub { owner = "protonvpn"; repo = "linux-cli"; - rev = "v${version}"; - sha256 = "0y7v9ikrmy5dbjlpbpacp08gy838i8z54m8m4ps7ldk1j6kyia3n"; + rev = version; + sha256 = "sha256-u+POtUz7NoGS23aOmvDCZPUp2HW1xXGtfbZR88cWCBc="; }; - propagatedBuildInputs = (with python3Packages; [ - requests - docopt - setuptools - jinja2 - pythondialog - ]) ++ [ - dialog - openvpn - iptables - ]; + propagatedBuildInputs = [ + protonvpn-nm-lib + pythondialog + dialog + ]; - # No tests + # Project has a dummy test doCheck = false; meta = with lib; { description = "Linux command-line client for ProtonVPN"; homepage = "https://github.com/protonvpn/linux-cli"; - maintainers = with maintainers; [ jtcoolen jefflabonte shamilton ]; + maintainers = with maintainers; [ wolfangaukang ]; license = licenses.gpl3Plus; platforms = platforms.linux; - mainProgram = "protonvpn"; + mainProgram = "protonvpn-cli"; }; } diff --git a/pkgs/development/python-modules/protonvpn-nm-lib/0001-Patching-GIRepository.patch b/pkgs/development/python-modules/protonvpn-nm-lib/0001-Patching-GIRepository.patch new file mode 100644 index 00000000000..bb34dff0b5a --- /dev/null +++ b/pkgs/development/python-modules/protonvpn-nm-lib/0001-Patching-GIRepository.patch @@ -0,0 +1,22 @@ +From 2867f022aad754fe54d95222b3ae52f6e7f14c2f Mon Sep 17 00:00:00 2001 +From: "P. R. d. O" +Date: Wed, 27 Apr 2022 21:49:12 -0600 +Subject: [PATCH] Patching GIRepository + +--- + protonvpn_nm_lib/__init__.py | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/protonvpn_nm_lib/__init__.py b/protonvpn_nm_lib/__init__.py +index e69de29..00b95f4 100644 +--- a/protonvpn_nm_lib/__init__.py ++++ b/protonvpn_nm_lib/__init__.py +@@ -0,0 +1,5 @@ ++import gi ++gi.require_version('GIRepository', '2.0') ++from gi.repository import GIRepository ++repo = GIRepository.Repository.get_default() ++repo.prepend_search_path('@networkmanager_path@') +-- +2.35.1 + diff --git a/pkgs/development/python-modules/protonvpn-nm-lib/default.nix b/pkgs/development/python-modules/protonvpn-nm-lib/default.nix index 9f12f220cfe..44e4b8e237d 100644 --- a/pkgs/development/python-modules/protonvpn-nm-lib/default.nix +++ b/pkgs/development/python-modules/protonvpn-nm-lib/default.nix @@ -2,6 +2,7 @@ , buildPythonPackage , fetchFromGitHub , pythonOlder +, substituteAll , distro , jinja2 , keyring @@ -9,18 +10,19 @@ , pygobject3 , pyxdg , systemd +, networkmanager }: buildPythonPackage rec { pname = "protonvpn-nm-lib"; - version = "3.8.0"; + version = "3.9.0"; disabled = pythonOlder "3.7"; src = fetchFromGitHub { owner = "ProtonVPN"; repo = pname; rev = version; - sha256 = "sha256-fAaP9c66LcbZgezadGPUt400YRnrnFoBvpzlc1zxuc4="; + sha256 = "sha256-yV3xeIyPc2DJj5DOa5PA1MHt00bjJ/Y9zZK77s/XRAA="; }; propagatedBuildInputs = [ @@ -33,7 +35,15 @@ buildPythonPackage rec { systemd ]; - # Project has a dummy test. + patches = [ + (substituteAll { + src = ./0001-Patching-GIRepository.patch; + networkmanager_path = "${networkmanager}/lib/girepository-1.0"; + }) + ]; + + # Checks cannot be run in the sandbox + # "Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory" doCheck = false; pythonImportsCheck = [ "protonvpn_nm_lib" ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b52153567c6..ae0c1c4f803 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -29046,7 +29046,8 @@ with pkgs; protonmail-bridge = callPackage ../applications/networking/protonmail-bridge { }; - protonvpn-cli = callPackage ../applications/networking/protonvpn-cli { }; + protonvpn-cli = python3Packages.callPackage ../applications/networking/protonvpn-cli { }; + protonvpn-cli_2 = python3Packages.callPackage ../applications/networking/protonvpn-cli/2.nix { }; protonvpn-gui = python3Packages.callPackage ../applications/networking/protonvpn-gui { };