1{ 2 lib, 3 buildPythonPackage, 4 pythonOlder, 5 fetchFromGitHub, 6 stdenv, 7 8 glib, 9 setuptools, 10}: 11 12buildPythonPackage rec { 13 pname = "darkdetect"; 14 version = "0.8.0"; 15 pyproject = true; 16 17 disabled = pythonOlder "3.6"; 18 19 src = fetchFromGitHub { 20 owner = "albertosottile"; 21 repo = "darkdetect"; 22 rev = "v${version}"; 23 hash = "sha256-OOINgrgjSLr3L07E9zf1+mlTPr+7ZlgN3CfkWE8+LoE="; 24 }; 25 26 nativeBuildInputs = [ setuptools ]; 27 28 pythonImportsCheck = [ "darkdetect" ]; 29 30 postPatch = lib.optionalString (stdenv.hostPlatform.isLinux) '' 31 substituteInPlace darkdetect/_linux_detect.py \ 32 --replace "'gsettings'" "'${glib.bin}/bin/gsettings'" 33 ''; 34 35 meta = with lib; { 36 description = "Detect OS Dark Mode from Python"; 37 homepage = "https://github.com/albertosottile/darkdetect"; 38 license = licenses.bsd3; 39 maintainers = [ ]; 40 }; 41}