1{
2 lib,
3 buildPythonApplication,
4 fetchFromGitHub,
5 gobject-introspection,
6 setuptools,
7 wrapGAppsHook3,
8 libnotify,
9 dbus-python,
10 packaging,
11 proton-core,
12 proton-keyring-linux,
13 proton-vpn-api-core,
14 proton-vpn-local-agent,
15 proton-vpn-network-manager,
16 pycairo,
17 pygobject3,
18 withIndicator ? true,
19 libappindicator-gtk3,
20 libayatana-appindicator,
21}:
22
23buildPythonApplication rec {
24 pname = "protonvpn-gui";
25 version = "4.9.7";
26 pyproject = true;
27
28 src = fetchFromGitHub {
29 owner = "ProtonVPN";
30 repo = "proton-vpn-gtk-app";
31 tag = "v${version}";
32 hash = "sha256-xpMXpYLLui+1bjK72VPhUT6T/sYpoqN2Jz6sczKJO5U=";
33 };
34
35 nativeBuildInputs = [
36 # Needed for the NM namespace
37 gobject-introspection
38 wrapGAppsHook3
39 ];
40
41 buildInputs = [
42 libnotify # gir typelib is used
43 ]
44 ++ lib.optionals withIndicator [
45 # Adds AppIndicator3 namespace
46 libappindicator-gtk3
47 # Adds AyatanaAppIndicator3 namespace
48 libayatana-appindicator
49 ];
50
51 build-system = [
52 setuptools
53 ];
54
55 dependencies = [
56 dbus-python
57 packaging
58 proton-core
59 proton-keyring-linux
60 proton-vpn-api-core
61 proton-vpn-local-agent
62 proton-vpn-network-manager
63 pycairo
64 pygobject3
65 ];
66
67 postInstall = ''
68 mkdir -p $out/share/{applications,pixmaps}
69 install -Dm 644 ${src}/rpmbuild/SOURCES/protonvpn-app.desktop $out/share/applications
70 install -Dm 644 ${src}/rpmbuild/SOURCES/proton-vpn-logo.svg $out/share/pixmaps
71 '';
72
73 preCheck = ''
74 # Needed for Permission denied: '/homeless-shelter'
75 export HOME=$(mktemp -d)
76 '';
77
78 # Gets a segmentation fault after the widgets test
79 doCheck = false;
80
81 meta = {
82 description = "Proton VPN GTK app for Linux";
83 homepage = "https://github.com/ProtonVPN/proton-vpn-gtk-app";
84 license = lib.licenses.gpl3Plus;
85 platforms = lib.platforms.linux;
86 mainProgram = "protonvpn-app";
87 maintainers = with lib.maintainers; [
88 sebtm
89 rapiteanu
90 ];
91 };
92}