nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 python,
6 buildPythonPackage,
7 cargo,
8 pypaInstallHook,
9 rustPlatform,
10}:
11
12buildPythonPackage rec {
13 pname = "proton-vpn-local-agent";
14 version = "1.6.0";
15 pyproject = false;
16 withDistOutput = false;
17
18 src = fetchFromGitHub {
19 owner = "ProtonVPN";
20 repo = "local-agent-rs";
21 rev = version;
22 hash = "sha256-rk3wi6q0UDuwh5yhLBqdLYsJxVqhlI+Yc7HZsiAU1Y8=";
23 };
24
25 cargoDeps = rustPlatform.fetchCargoVendor {
26 inherit
27 pname
28 version
29 src
30 sourceRoot
31 ;
32 hash = "sha256-jjSkPgGp3Yvypnlrt9pV1F/K3o2doNteQs1rwr5fhnM=";
33 };
34
35 sourceRoot = "${src.name}/python-proton-vpn-local-agent";
36
37 cargoBuildType = "release";
38 nativeBuildInputs = [
39 cargo
40 pypaInstallHook
41 rustPlatform.cargoSetupHook
42 rustPlatform.cargoBuildHook
43 ];
44
45 cargoCheckType = "release";
46 nativeCheckInputs = [
47 rustPlatform.cargoCheckHook
48 ];
49
50 postPatch = ''
51 substituteInPlace scripts/build_wheel.py \
52 --replace-fail 'ARCH = "x86_64"' \
53 'ARCH = "${stdenv.hostPlatform.uname.processor}"' \
54 --replace-fail 'LIB_PATH = get_lib_path("x86_64-unknown-linux-gnu")' \
55 'LIB_PATH = get_lib_path("${stdenv.hostPlatform.config}")'
56 '';
57
58 postBuild = ''
59 ${python.interpreter} scripts/build_wheel.py
60 mkdir -p ./dist
61 cp ./target/*.whl ./dist
62 '';
63
64 pythonImportsCheck = [ "proton.vpn.local_agent" ];
65
66 meta = {
67 description = "Proton VPN local agent written in Rust with Python bindings";
68 homepage = "https://github.com/ProtonVPN/local-agent-rs";
69 license = lib.licenses.gpl3Only;
70 platforms = lib.platforms.linux;
71 maintainers = with lib.maintainers; [
72 anthonyroussel
73 sebtm
74 rapiteanu
75 ];
76 };
77}