summary refs log tree commit diff
path: root/pkgs/applications/networking/protonvpn-gui/default.nix
diff options
context:
space:
mode:
authorJaka Hudoklin <jaka@x-truder.net>2020-07-14 22:44:55 +0200
committerJaka Hudoklin <jaka@x-truder.net>2020-07-20 10:36:17 +0200
commitb488383c0ba39fa8af44e3ca5bf973770456a219 (patch)
tree8f91a3c9d59b4c157546cdc2f44bfcdef5788757 /pkgs/applications/networking/protonvpn-gui/default.nix
parent38db4a92e5297c0cf44f5e68a8a92ee089a72f8a (diff)
downloadnixpkgs-b488383c0ba39fa8af44e3ca5bf973770456a219.tar
nixpkgs-b488383c0ba39fa8af44e3ca5bf973770456a219.tar.gz
nixpkgs-b488383c0ba39fa8af44e3ca5bf973770456a219.tar.bz2
nixpkgs-b488383c0ba39fa8af44e3ca5bf973770456a219.tar.lz
nixpkgs-b488383c0ba39fa8af44e3ca5bf973770456a219.tar.xz
nixpkgs-b488383c0ba39fa8af44e3ca5bf973770456a219.tar.zst
nixpkgs-b488383c0ba39fa8af44e3ca5bf973770456a219.zip
protonvpn-gui: init at 2.1.1
Diffstat (limited to 'pkgs/applications/networking/protonvpn-gui/default.nix')
-rw-r--r--pkgs/applications/networking/protonvpn-gui/default.nix86
1 files changed, 86 insertions, 0 deletions
diff --git a/pkgs/applications/networking/protonvpn-gui/default.nix b/pkgs/applications/networking/protonvpn-gui/default.nix
new file mode 100644
index 00000000000..38ffb42aaf8
--- /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;
+  };
+}