From 38db4a92e5297c0cf44f5e68a8a92ee089a72f8a Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Tue, 14 Jul 2020 22:40:36 +0200 Subject: [PATCH 1/2] protonvpn-cli: replace old protonvpn-cli with protonvpn-cli-ng --- .../networking/protonvpn-cli-ng/default.nix | 36 ------------ .../networking/protonvpn-cli/default.nix | 57 ++++++++----------- pkgs/top-level/all-packages.nix | 2 - 3 files changed, 25 insertions(+), 70 deletions(-) delete mode 100644 pkgs/applications/networking/protonvpn-cli-ng/default.nix diff --git a/pkgs/applications/networking/protonvpn-cli-ng/default.nix b/pkgs/applications/networking/protonvpn-cli-ng/default.nix deleted file mode 100644 index e2870c58e971..000000000000 --- a/pkgs/applications/networking/protonvpn-cli-ng/default.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ lib, fetchFromGitHub, python3Packages, openvpn, dialog, iptables }: - -python3Packages.buildPythonApplication rec { - pname = "protonvpn-cli-ng"; - version = "2.2.4"; - - src = fetchFromGitHub { - owner = "protonvpn"; - repo = "${pname}"; - rev = "v${version}"; - sha256 = "08yca0a0prrnrc7ir7ajd56yxvxpcs4m1k8f5kf273f5whgr7wzw"; - }; - - propagatedBuildInputs = (with python3Packages; [ - requests - docopt - setuptools - jinja2 - pythondialog - ]) ++ [ - dialog - openvpn - iptables - ]; - - # No tests - doCheck = false; - - meta = with lib; { - description = "Linux command-line client for ProtonVPN"; - homepage = "https://github.com/protonvpn/protonvpn-cli-ng"; - maintainers = with maintainers; [ jtcoolen jefflabonte ]; - license = licenses.gpl3; - platforms = platforms.unix; - }; -} diff --git a/pkgs/applications/networking/protonvpn-cli/default.nix b/pkgs/applications/networking/protonvpn-cli/default.nix index c48f6c820269..1c72d4ef88c0 100644 --- a/pkgs/applications/networking/protonvpn-cli/default.nix +++ b/pkgs/applications/networking/protonvpn-cli/default.nix @@ -1,43 +1,36 @@ -{ stdenv, lib, fetchFromGitHub, makeWrapper, coreutils -, openvpn, python, dialog, wget, update-resolv-conf }: +{ lib, fetchFromGitHub, python3Packages, openvpn, dialog, iptables }: -let - expectedUpdateResolvPath = "/etc/openvpn/update-resolv-conf"; - actualUpdateResolvePath = "${update-resolv-conf}/libexec/openvpn/update-resolv-conf"; - -in stdenv.mkDerivation rec { - name = "protonvpn-cli"; - version = "1.1.2"; +python3Packages.buildPythonApplication rec { + pname = "protonvpn-linux-cli"; + version = "2.2.4"; src = fetchFromGitHub { - owner = "ProtonVPN"; - repo = "protonvpn-cli"; + owner = "protonvpn"; + repo = "linux-cli"; rev = "v${version}"; - sha256 = "0xvflr8zf267n3dv63nkk4wjxhbckw56sqmyca3krf410vrd7zlv"; + sha256 = "08yca0a0prrnrc7ir7ajd56yxvxpcs4m1k8f5kf273f5whgr7wzw"; }; - nativeBuildInputs = [ makeWrapper ]; + propagatedBuildInputs = (with python3Packages; [ + requests + docopt + setuptools + jinja2 + pythondialog + ]) ++ [ + dialog + openvpn + iptables + ]; - installPhase = '' - mkdir -p "$out/bin" - substituteInPlace protonvpn-cli.sh \ - --replace ${expectedUpdateResolvPath} ${actualUpdateResolvePath} \ - --replace \$UID 0 \ - --replace /etc/resolv.conf /dev/null \ - --replace \ - " echo \"Connecting...\"" \ - " sed -ri 's@${expectedUpdateResolvPath}@${actualUpdateResolvePath}@g' \"\$openvpn_config\"; echo \"Connecting...\"" - cp protonvpn-cli.sh "$out/bin/protonvpn-cli" - wrapProgram $out/bin/protonvpn-cli \ - --prefix PATH : ${lib.makeBinPath [ coreutils openvpn python dialog wget update-resolv-conf ]} - ln -s "$out/bin/protonvpn-cli" "$out/bin/pvpn" - ''; + # No tests + doCheck = false; - meta = with stdenv.lib; { - description = "ProtonVPN Command-Line Tool"; - homepage = "https://github.com/ProtonVPN/protonvpn-cli"; - maintainers = with maintainers; [ caugner ]; - license = licenses.mit; + meta = with lib; { + description = "Linux command-line client for ProtonVPN"; + homepage = "https://github.com/protonvpn/linux-cli"; + maintainers = with maintainers; [ jtcoolen jefflabonte ]; + license = licenses.gpl3; platforms = platforms.unix; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5e397bf15562..b45e3d85ccc1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21948,8 +21948,6 @@ in protonvpn-cli = callPackage ../applications/networking/protonvpn-cli { }; - protonvpn-cli-ng = callPackage ../applications/networking/protonvpn-cli-ng { }; - ps2client = callPackage ../applications/networking/ps2client { }; psi = libsForQt5.callPackage ../applications/networking/instant-messengers/psi { }; From b488383c0ba39fa8af44e3ca5bf973770456a219 Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Tue, 14 Jul 2020 22:44:55 +0200 Subject: [PATCH 2/2] protonvpn-gui: init at 2.1.1 --- .../networking/protonvpn-gui/default.nix | 86 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 88 insertions(+) create mode 100644 pkgs/applications/networking/protonvpn-gui/default.nix diff --git a/pkgs/applications/networking/protonvpn-gui/default.nix b/pkgs/applications/networking/protonvpn-gui/default.nix new file mode 100644 index 000000000000..38ffb42aaf81 --- /dev/null +++ b/pkgs/applications/networking/protonvpn-gui/default.nix @@ -0,0 +1,86 @@ +{ lib, fetchFromGitHub, makeDesktopItem, makeWrapper, imagemagick +, python3Packages, wrapGAppsHook, protonvpn-cli, gtk3, pango +, gobject-introspection, libnotify, libappindicator-gtk3 +, procps, openvpn }: + +let + extraPath = lib.makeBinPath [ procps openvpn ]; + +in python3Packages.buildPythonApplication rec { + pname = "protonvpn-linux-gui"; + version = "2.1.1"; + + src = fetchFromGitHub { + owner = "protonvpn"; + repo = "linux-gui"; + rev = "v${version}"; + sha256 = "avo5/2eq53HSHCnnjtxrsmpURtHvxmLZn2BxActImGY="; + }; + + desktopItem = makeDesktopItem { + name = "ProtonVPN"; + desktopName = "ProtonVPN GUI"; + type = "Application"; + exec = "protonvpn-gui"; + icon = "protonvpn"; + categories = "Network;"; + terminal = "false"; + }; + + trayDesktopItem = makeDesktopItem { + name = "ProtonVPN Tray"; + desktopName = "ProtonVPN Tray"; + type = "Application"; + exec = "protonvpn-tray"; + icon = "protonvpn"; + categories = "Network;"; + terminal = "false"; + }; + + nativeBuildInputs = [ wrapGAppsHook makeWrapper imagemagick ]; + + propagatedBuildInputs = (with python3Packages; [ + pygobject3 + pycairo + requests + configparser + ]) ++ [ + protonvpn-cli + gtk3 + gobject-introspection + libnotify + libappindicator-gtk3 + ]; + + prePatch = '' + # if pkexec is used, we want to have more time to enter password + substituteInPlace linux_gui/services/login_service.py --replace 'timeout=8' 'timeout=30' + ''; + + postInstall = '' + # wrap binaries with extra required path + wrapProgram "$out/bin/protonvpn-tray" --prefix PATH ":" ${extraPath} + wrapProgram "$out/bin/protonvpn-gui" --prefix PATH ":" ${extraPath} + + # install desktop files + mkdir -p $out/share/applications + cp "$desktopItem/share/applications/ProtonVPN.desktop" $out/share/applications/protonvpn-gui.desktop + cp "$trayDesktopItem/share/applications/ProtonVPN Tray.desktop" $out/share/applications/protonvpn-tray.desktop + + # create icons + for size in 16 32 48 64 72 96 128 192 512 1024; do + mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps + convert -resize "$size"x"$size" \ + linux_gui/resources/img/logo/protonvpn_logo.png \ + $out/share/icons/hicolor/"$size"x"$size"/apps/protonvpn.png + done + ''; + + meta = with lib; { + description = "Linux GUI for ProtonVPN, written in Python."; + homepage = "https://github.com/ProtonVPN/linux-gui"; + maintainers = with maintainers; [ offline ]; + license = licenses.gpl3; + platforms = platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b45e3d85ccc1..f9a4c67bd899 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21948,6 +21948,8 @@ in protonvpn-cli = callPackage ../applications/networking/protonvpn-cli { }; + protonvpn-gui = callPackage ../applications/networking/protonvpn-gui { }; + ps2client = callPackage ../applications/networking/ps2client { }; psi = libsForQt5.callPackage ../applications/networking/instant-messengers/psi { };