nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 fetchFromGitHub,
6 libX11,
7 libXinerama,
8 libXrandr,
9 poetry-core,
10 pytestCheckHook,
11}:
12
13buildPythonPackage rec {
14 pname = "screeninfo";
15 version = "0.8.1";
16 pyproject = true;
17
18 src = fetchFromGitHub {
19 owner = "rr-";
20 repo = "screeninfo";
21 tag = version;
22 hash = "sha256-TEy4wff0eRRkX98yK9054d33Tm6G6qWrd9Iv+ITcFmA=";
23 };
24
25 nativeBuildInputs = [ poetry-core ];
26
27 postPatch = ''
28 substituteInPlace screeninfo/enumerators/xinerama.py \
29 --replace 'load_library("X11")' 'ctypes.cdll.LoadLibrary("${libX11}/lib/libX11.so")' \
30 --replace 'load_library("Xinerama")' 'ctypes.cdll.LoadLibrary("${libXinerama}/lib/libXinerama.so")'
31 substituteInPlace screeninfo/enumerators/xrandr.py \
32 --replace 'load_library("X11")' 'ctypes.cdll.LoadLibrary("${libX11}/lib/libX11.so")' \
33 --replace 'load_library("Xrandr")' 'ctypes.cdll.LoadLibrary("${libXrandr}/lib/libXrandr.so")'
34 '';
35
36 nativeCheckInputs = [ pytestCheckHook ];
37
38 disabledTestPaths = [
39 # We don't have a screen
40 "tests/test_screeninfo.py"
41 ];
42
43 pythonImportsCheck = [ "screeninfo" ];
44
45 meta = {
46 broken = stdenv.hostPlatform.isDarwin;
47 description = "Fetch location and size of physical screens";
48 homepage = "https://github.com/rr-/screeninfo";
49 license = lib.licenses.mit;
50 maintainers = with lib.maintainers; [ nickhu ];
51 };
52}