2021-12-06 16:07:01 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pythonOlder
|
2022-05-18 14:49:53 +00:00
|
|
|
, substituteAll
|
2022-06-16 17:23:12 +00:00
|
|
|
, dbus-python
|
2021-12-06 16:07:01 +00:00
|
|
|
, distro
|
|
|
|
, jinja2
|
|
|
|
, keyring
|
|
|
|
, proton-client
|
|
|
|
, pygobject3
|
|
|
|
, pyxdg
|
|
|
|
, systemd
|
2022-06-16 17:23:12 +00:00
|
|
|
, ncurses
|
2022-05-18 14:49:53 +00:00
|
|
|
, networkmanager
|
2022-06-16 17:23:12 +00:00
|
|
|
, pkgs-systemd
|
2022-08-12 12:06:08 +00:00
|
|
|
, python
|
2022-06-16 17:23:12 +00:00
|
|
|
, xdg-utils
|
2022-08-12 12:06:08 +00:00
|
|
|
, makeWrapper
|
2021-12-06 16:07:01 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "protonvpn-nm-lib";
|
2022-12-17 10:02:37 +00:00
|
|
|
version = "3.14.0";
|
2021-12-06 16:07:01 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ProtonVPN";
|
|
|
|
repo = pname;
|
2022-09-14 18:05:37 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2023-03-15 16:39:30 +00:00
|
|
|
hash = "sha256-xpK3l8BI6/DUt46VR8DS89hzdHUljAbrYhEyf00giGg=";
|
2021-12-06 16:07:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
2022-06-16 17:23:12 +00:00
|
|
|
dbus-python
|
2021-12-06 16:07:01 +00:00
|
|
|
distro
|
|
|
|
jinja2
|
|
|
|
keyring
|
|
|
|
proton-client
|
|
|
|
pygobject3
|
|
|
|
pyxdg
|
|
|
|
systemd
|
2022-06-16 17:23:12 +00:00
|
|
|
ncurses
|
|
|
|
networkmanager
|
|
|
|
pkgs-systemd
|
|
|
|
xdg-utils
|
2021-12-06 16:07:01 +00:00
|
|
|
];
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./0001-Patching-GIRepository.patch;
|
|
|
|
networkmanager_path = "${networkmanager}/lib/girepository-1.0";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace protonvpn_nm_lib/core/dbus/dbus_reconnect.py \
|
|
|
|
--replace "exec_start = python_interpreter_path + \" \" + python_service_path" "exec_start = \"$out/bin/protonvpn_reconnector.py\""
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
makeWrapper ${python.interpreter} $out/bin/protonvpn_reconnector.py \
|
|
|
|
--add-flags $out/${python.sitePackages}/protonvpn_nm_lib/daemon/dbus_daemon_reconnector.py \
|
|
|
|
--prefix PYTHONPATH : "$PYTHONPATH"
|
|
|
|
'';
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
# Checks cannot be run in the sandbox
|
|
|
|
# "Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory"
|
2021-12-06 16:07:01 +00:00
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "protonvpn_nm_lib" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "ProtonVPN NetworkManager Library intended for every ProtonVPN service user";
|
|
|
|
homepage = "https://github.com/ProtonVPN/protonvpn-nm-lib";
|
|
|
|
license = licenses.gpl3Only;
|
|
|
|
maintainers = with maintainers; [ wolfangaukang ];
|
2022-05-18 14:49:53 +00:00
|
|
|
platforms = platforms.linux;
|
2021-12-06 16:07:01 +00:00
|
|
|
};
|
|
|
|
}
|