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 pyobjc-framework-Cocoa,
11 cython,
12 pytestCheckHook,
13}:
14
15buildPythonPackage rec {
16 pname = "screeninfo";
17 version = "0.8.1";
18 pyproject = true;
19
20 src = fetchFromGitHub {
21 owner = "rr-";
22 repo = "screeninfo";
23 tag = version;
24 hash = "sha256-TEy4wff0eRRkX98yK9054d33Tm6G6qWrd9Iv+ITcFmA=";
25 };
26
27 build-system = [ poetry-core ];
28
29 dependencies = lib.optionals (stdenv.isDarwin) [
30 pyobjc-framework-Cocoa
31 cython
32 ];
33
34 postPatch = lib.optionalString (stdenv.isLinux) ''
35 substituteInPlace screeninfo/enumerators/xinerama.py \
36 --replace 'load_library("X11")' 'ctypes.cdll.LoadLibrary("${libx11}/lib/libX11.so")' \
37 --replace 'load_library("Xinerama")' 'ctypes.cdll.LoadLibrary("${libxinerama}/lib/libXinerama.so")'
38 substituteInPlace screeninfo/enumerators/xrandr.py \
39 --replace 'load_library("X11")' 'ctypes.cdll.LoadLibrary("${libx11}/lib/libX11.so")' \
40 --replace 'load_library("Xrandr")' 'ctypes.cdll.LoadLibrary("${libxrandr}/lib/libXrandr.so")'
41 '';
42
43 nativeCheckInputs = [ pytestCheckHook ];
44
45 disabledTestPaths = [
46 # We don't have a screen
47 "tests/test_screeninfo.py"
48 ];
49
50 pythonImportsCheck = [ "screeninfo" ];
51
52 meta = {
53 description = "Fetch location and size of physical screens";
54 homepage = "https://github.com/rr-/screeninfo";
55 license = lib.licenses.mit;
56 maintainers = with lib.maintainers; [ nickhu ];
57 };
58}