Last active
May 9, 2022 15:56
-
-
Save WolfangAukang/ae5530af0919dd0f750d3130dfa6a493 to your computer and use it in GitHub Desktop.
Patch to enable test `protonvpn-nm-lib`. Currently, it fails because it needs to use DBus and can't be found in Nix sandbox. Credits to @NKJe for providing the patches at https://github.com/NixOS/nixpkgs/pull/129333
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/protonvpn_nm_lib/core/subprocess_wrapper.py | |
+++ b/protonvpn_nm_lib/core/subprocess_wrapper.py | |
@@ -44,11 +44,9 @@ | |
binary_short_name => full secure path. | |
""" | |
# Look for root-owned directories in the system path in order | |
- for path in os.environ.get('PATH', '').split(os.path.pathsep): | |
+ for path in "@path@".split(os.path.pathsep): | |
if not os.path.isdir(path): | |
continue | |
- if not self.is_root_owned(path): | |
- continue | |
# Check for all the binaries that we haven't matched yet | |
for binary in self._acceptable_binaries.difference( | |
@@ -58,9 +56,6 @@ | |
if not os.path.isfile(binary_path_candidate): | |
continue | |
- if not self.is_root_owned(binary_path_candidate): | |
- continue | |
- | |
# We're happy with that one, store it | |
self._path_to_binaries[binary] = binary_path_candidate | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ lib | |
, buildPythonPackage | |
, fetchFromGitHub | |
, pythonOlder | |
, substituteAll | |
, distro | |
, jinja2 | |
, keyring | |
, proton-client | |
, pygobject3 | |
, pyxdg | |
, systemd | |
, networkmanager | |
, ncurses | |
, systemd-pkg | |
, xdg-utils | |
}: | |
buildPythonPackage rec { | |
pname = "protonvpn-nm-lib"; | |
version = "3.9.0"; | |
disabled = pythonOlder "3.7"; | |
src = fetchFromGitHub { | |
owner = "ProtonVPN"; | |
repo = pname; | |
rev = version; | |
sha256 = "sha256-yV3xeIyPc2DJj5DOa5PA1MHt00bjJ/Y9zZK77s/XRAA="; | |
}; | |
propagatedBuildInputs = [ | |
distro | |
jinja2 | |
keyring | |
proton-client | |
pygobject3 | |
pyxdg | |
systemd | |
]; | |
checkInputs = [ | |
ncurses | |
networkmanager | |
systemd-pkg | |
xdg-utils | |
]; | |
patches = [ | |
(substituteAll { | |
src = ./0001-Patching-GIRepository.patch; | |
networkmanager_path = "${networkmanager}/lib/girepository-1.0"; | |
}) | |
(substituteAll { | |
src = ./binary-paths.patch; | |
path = lib.makeBinPath checkInputs; | |
}) | |
]; | |
# Checks cannot be run in the sandbox | |
# "Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory" | |
#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 ]; | |
platforms = platforms.linux; | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protonvpn-nm-lib = callPackage ../development/python-modules/protonvpn-nm-lib { | |
systemd-pkg = pkgs.systemd | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment