Merge pull request #93276 from xtruder/pkgs/protonvpn-linux-gui/init

protonvpn-gui: init at 2.1.1
This commit is contained in:
Jaka Hudoklin 2020-08-18 08:42:14 +02:00 committed by GitHub
commit 5e6bc32cbb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 112 additions and 69 deletions

View file

@ -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;
};
}

View file

@ -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;
};
}

View file

@ -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;
};
}

View file

@ -22244,7 +22244,7 @@ in
protonvpn-cli = callPackage ../applications/networking/protonvpn-cli { };
protonvpn-cli-ng = callPackage ../applications/networking/protonvpn-cli-ng { };
protonvpn-gui = callPackage ../applications/networking/protonvpn-gui { };
ps2client = callPackage ../applications/networking/ps2client { };