nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
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 src = fetchFromGitHub {
17 owner = "albertosottile";
18 repo = "darkdetect";
19 rev = "v${version}";
20 hash = "sha256-OOINgrgjSLr3L07E9zf1+mlTPr+7ZlgN3CfkWE8+LoE=";
21 };
22
23 nativeBuildInputs = [ setuptools ];
24
25 pythonImportsCheck = [ "darkdetect" ];
26
27 postPatch = lib.optionalString (stdenv.hostPlatform.isLinux) ''
28 substituteInPlace darkdetect/_linux_detect.py \
29 --replace "'gsettings'" "'${glib.bin}/bin/gsettings'"
30 '';
31
32 meta = {
33 description = "Detect OS Dark Mode from Python";
34 homepage = "https://github.com/albertosottile/darkdetect";
35 license = lib.licenses.bsd3;
36 maintainers = [ ];
37 };
38}