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