about summary refs log tree commit diff
path: root/pkgs/applications/networking/protonvpn-gui/legacy.nix
blob: 32828b5590f675707b8157f475ff4f407d44adf9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{ lib
, buildPythonApplication
, fetchFromGitHub
, setuptools
, wrapGAppsHook3
, gdk-pixbuf
, glib-networking
, gobject-introspection
, imagemagick
, librsvg
, pango
, python3
, webkitgtk
# Python libs
, protonvpn-nm-lib
, psutil
# Optionals
, withIndicator ? true
, libappindicator-gtk3 }:

buildPythonApplication rec {
  pname = "protonvpn-gui";
  version = "1.12.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "ProtonVPN";
    repo = "linux-app";
    rev = "refs/tags/${version}";
    sha256 = "sha256-MPS4d/yNkccsc/j85h7/4k4xL8uSCvhj/9JWPa7ezLY=";
  };

  nativeBuildInputs = [
    gdk-pixbuf
    gobject-introspection
    imagemagick
    setuptools
    wrapGAppsHook3
  ];

  propagatedBuildInputs = [
    glib-networking # needed for the login captcha
    protonvpn-nm-lib
    psutil
  ];

  buildInputs = [
    librsvg
    pango
    webkitgtk
  ] ++ lib.optionals withIndicator [ libappindicator-gtk3 ];

  postInstall = ''
    # Setting 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 \
        protonvpn_gui/assets/icons/protonvpn-logo.png \
        $out/share/icons/hicolor/$size'x'$size/apps/protonvpn.png
    done

    install -Dm644 protonvpn.desktop -t $out/share/applications/
    chmod 644 $out/${python3.sitePackages}/protonvpn_gui/assets/icons/plus-server.png
    substituteInPlace $out/share/applications/protonvpn.desktop \
      --replace 'protonvpn-logo' protonvpn
  '';

  # Project has a dummy test
  doCheck = false;

  meta = with lib; {
    description = "Official ProtonVPN Linux app";
    homepage = "https://github.com/ProtonVPN/linux-app";
    maintainers = with maintainers; [ wolfangaukang ];
    license = licenses.gpl3Plus;
    mainProgram = "protonvpn";
    platforms = platforms.linux;
  };
}