about summary refs log tree commit diff
path: root/pkgs/development/python-modules/proton-vpn-session/default.nix
blob: 6295038b6f9ee6ed84d434de7b24df5c42bb4240 (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
{ lib
, buildPythonPackage
, fetchFromGitHub
, setuptools
, cryptography
, distro
, proton-core
, proton-vpn-logger
, pynacl
, aiohttp
, pyopenssl
, pytest-asyncio
, requests
, pytestCheckHook
}:

buildPythonPackage rec {
  pname = "proton-vpn-session";
  version = "0.6.7";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "ProtonVPN";
    repo = "python-proton-vpn-session";
    rev = "refs/tags/v${version}";
    hash = "sha256-/5ju/2bxhqK6JWchkxFe3amBKHtO98GCVQWIrUsn+nQ=";
  };

  nativeBuildInputs = [
    setuptools
  ];

  propagatedBuildInputs = [
    cryptography
    distro
    proton-core
    proton-vpn-logger
    pynacl
  ];

  postPatch = ''
    substituteInPlace setup.cfg \
      --replace-fail "--cov=proton.vpn.session --cov-report term" ""
  '';

  pythonImportsCheck = [ "proton.vpn.session" ];

  postInstall = ''
    # Needed for Permission denied: '/homeless-shelter'
    export HOME=$(mktemp -d)
  '';

  nativeCheckInputs = [
    aiohttp
    pyopenssl
    pytest-asyncio
    requests
    pytestCheckHook
  ];

  meta = {
    description = "Provides utility classes to manage VPN sessions";
    homepage = "https://github.com/ProtonVPN/python-proton-vpn-session";
    license = lib.licenses.gpl3Only;
    maintainers = with lib.maintainers; [ wolfangaukang ];
  };
}