about summary refs log tree commit diff
path: root/pkgs/applications/window-managers/qtile/default.nix
blob: 8c5d65d4978f42ca2ecc5846a0a7d83b587f481b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{ lib, fetchFromGitHub, python3, mypy, glib, cairo, pango, pkg-config, libxcb, xcbutilcursor }:

let
  enabled-xcffib = cairocffi-xcffib: cairocffi-xcffib.override {
    withXcffib = true;
  };

  # make it easier to reference python
  python = python3;
  pythonPackages = python.pkgs;

  unwrapped = pythonPackages.buildPythonPackage rec {
    pname = "qtile";
    version = "0.19.0";

    src = fetchFromGitHub {
      owner = "qtile";
      repo = "qtile";
      rev = "v${version}";
      sha256 = "BLHGVPMQd8O4h5TVx/F/klzSra+FZYogp22V6Yq04T0=";
    };

    postPatch = ''
      substituteInPlace libqtile/pangocffi.py \
        --replace libgobject-2.0.so.0 ${glib.out}/lib/libgobject-2.0.so.0 \
        --replace libpangocairo-1.0.so.0 ${pango.out}/lib/libpangocairo-1.0.so.0 \
        --replace libpango-1.0.so.0 ${pango.out}/lib/libpango-1.0.so.0
      substituteInPlace libqtile/backend/x11/xcursors.py \
        --replace libxcb-cursor.so.0 ${xcbutilcursor.out}/lib/libxcb-cursor.so.0
    '';

    SETUPTOOLS_SCM_PRETEND_VERSION = version;

    nativeBuildInputs = [
      pkg-config
    ] ++ (with pythonPackages; [
      setuptools-scm
    ]);

    propagatedBuildInputs = with pythonPackages; [
      xcffib
      (enabled-xcffib cairocffi)
      setuptools
      python-dateutil
      dbus-python
      mpd2
      psutil
      pyxdg
      pygobject3
      pywayland
      pywlroots
      xkbcommon
    ];

    # for `qtile check`, needs `stubtest` and `mypy` commands
    makeWrapperArgs = [
      "--suffix PATH : ${lib.makeBinPath [ mypy ]}"
    ];

    doCheck = false; # Requires X server #TODO this can be worked out with the existing NixOS testing infrastructure.

    meta = with lib; {
      homepage = "http://www.qtile.org/";
      license = licenses.mit;
      description = "A small, flexible, scriptable tiling window manager written in Python";
      platforms = platforms.linux;
      maintainers = with maintainers; [ kamilchm ];
    };
  };
in
  (python.withPackages (ps: [ unwrapped ])).overrideAttrs (_: {
    # otherwise will be exported as "env", this restores `nix search` behavior
    name = "${unwrapped.pname}-${unwrapped.version}";
    # export underlying qtile package
    passthru = { inherit unwrapped; };
  })