From d4b7278fbdf6c936f5d7cc1dff6d63288e332b3e Mon Sep 17 00:00:00 2001 From: Ivan Babrou Date: Fri, 5 Mar 2021 17:46:04 -0800 Subject: [PATCH] python3Packages.py-cpuinfo: add sysctl to runtime dependencies --- pkgs/development/python-modules/py-cpuinfo/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/development/python-modules/py-cpuinfo/default.nix b/pkgs/development/python-modules/py-cpuinfo/default.nix index 455b91663e2..0afc75bf87c 100644 --- a/pkgs/development/python-modules/py-cpuinfo/default.nix +++ b/pkgs/development/python-modules/py-cpuinfo/default.nix @@ -1,7 +1,9 @@ { lib +, stdenv , fetchFromGitHub , buildPythonPackage , pytestCheckHook +, sysctl }: buildPythonPackage rec { @@ -15,6 +17,13 @@ buildPythonPackage rec { sha256 = "10qfaibyb2syiwiyv74l7d97vnmlk079qirgnw3ncklqjs0s3gbi"; }; + # On Darwin sysctl is used to read CPU information. + postPatch = lib.optionalString stdenv.isDarwin '' + substituteInPlace cpuinfo/cpuinfo.py \ + --replace "len(_program_paths('sysctl')) > 0" "True" \ + --replace "_run_and_get_stdout(['sysctl'" "_run_and_get_stdout(['${sysctl}/bin/sysctl'" + ''; + checkInputs = [ pytestCheckHook ];