1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 cryptography,
6 setuptools,
7 jinja2,
8 proton-core,
9 pynacl,
10 aiohttp,
11 pyopenssl,
12 pytest-asyncio,
13 requests,
14 sentry-sdk,
15 distro,
16 pytestCheckHook,
17 pytest-cov-stub,
18}:
19
20buildPythonPackage rec {
21 pname = "proton-vpn-api-core";
22 version = "0.38.2";
23 pyproject = true;
24
25 src = fetchFromGitHub {
26 owner = "ProtonVPN";
27 repo = "python-proton-vpn-api-core";
28 rev = "v${version}";
29 hash = "sha256-ldIslr2qiwClQW6rWNbEAAkUbdJfCzvUIkCuoajP2M4=";
30 };
31
32 build-system = [
33 setuptools
34 ];
35
36 dependencies = [
37 cryptography
38 distro
39 jinja2
40 pynacl
41 proton-core
42 sentry-sdk
43 ];
44
45 pythonImportsCheck = [
46 "proton.vpn.core"
47 "proton.vpn.connection"
48 "proton.vpn.killswitch.interface"
49 "proton.vpn.logging"
50 "proton.vpn.session"
51 ];
52
53 nativeCheckInputs = [
54 aiohttp
55 pyopenssl
56 pytest-asyncio
57 requests
58 pytestCheckHook
59 pytest-cov-stub
60 ];
61
62 postInstall = ''
63 # Needed for Permission denied: '/homeless-shelter'
64 export HOME=$(mktemp -d)
65 '';
66
67 disabledTests = [
68 # Permission denied: '/run'
69 "test_ensure_configuration_file_is_created"
70 "test_ovpnconfig_with_certificate"
71 "test_ovpnconfig_with_settings"
72 "test_wireguard_config_content_generation"
73 "test_wireguard_with_non_certificate"
74 "test_ensure_generate_is_returning_expected_content"
75 "test_ensure_same_configuration_file_in_case_of_duplicate"
76 "test_ensure_configuration_file_is_deleted"
77 ];
78
79 meta = {
80 description = "Acts as a facade to the other Proton VPN components, exposing a uniform API to the available Proton VPN services";
81 homepage = "https://github.com/ProtonVPN/python-proton-vpn-api-core";
82 license = lib.licenses.gpl3Only;
83 platforms = lib.platforms.linux;
84 maintainers = with lib.maintainers; [ sebtm ];
85 };
86}