about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/window-managers/qtile/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/window-managers/qtile/default.nix')
-rw-r--r--nixpkgs/pkgs/applications/window-managers/qtile/default.nix108
1 files changed, 55 insertions, 53 deletions
diff --git a/nixpkgs/pkgs/applications/window-managers/qtile/default.nix b/nixpkgs/pkgs/applications/window-managers/qtile/default.nix
index 08b3a9834b6a..ae62cdbbba14 100644
--- a/nixpkgs/pkgs/applications/window-managers/qtile/default.nix
+++ b/nixpkgs/pkgs/applications/window-managers/qtile/default.nix
@@ -1,66 +1,68 @@
-{ lib, fetchFromGitHub, python37Packages, glib, cairo, pango, pkg-config, libxcb, xcbutilcursor }:
+{ lib, fetchFromGitHub, python3, glib, cairo, pango, pkg-config, libxcb, xcbutilcursor }:
 
-let cairocffi-xcffib = python37Packages.cairocffi.override {
+let
+  enabled-xcffib = cairocffi-xcffib: cairocffi-xcffib.override {
     withXcffib = true;
   };
-in
-
-python37Packages.buildPythonApplication rec {
-  name = "qtile-${version}";
-  version = "0.16.0";
 
-  src = fetchFromGitHub {
-    owner = "qtile";
-    repo = "qtile";
-    rev = "v${version}";
-    sha256 = "1klv1k9847nyx71sfrhqyl1k51k2w8phqnp2bns4dvbqii7q125l";
-  };
+  # make it easier to reference python
+  python = python3;
+  pythonPackages = python.pkgs;
 
-  patches = [
-    ./0001-Substitution-vars-for-absolute-paths.patch
-    ./0002-Restore-PATH-and-PYTHONPATH.patch
-    ./0003-Restart-executable.patch
-  ];
+  unwrapped = pythonPackages.buildPythonPackage rec {
+    pname = "qtile";
+    version = "0.18.0";
 
-  postPatch = ''
-    substituteInPlace libqtile/core/manager.py --subst-var-by out $out
-    substituteInPlace libqtile/pangocffi.py --subst-var-by glib ${glib.out}
-    substituteInPlace libqtile/pangocffi.py --subst-var-by pango ${pango.out}
-    substituteInPlace libqtile/backend/x11/xcursors.py --subst-var-by xcb-cursor ${xcbutilcursor.out}
-  '';
+    src = fetchFromGitHub {
+      owner = "qtile";
+      repo = "qtile";
+      rev = "v${version}";
+      sha256 = "sha256-S9G/EI18p9EAyWgI1ajDrLimeE+ETBC9feUDb/QthqI=";
+    };
 
-  SETUPTOOLS_SCM_PRETEND_VERSION = version;
+    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
+    '';
 
-  nativeBuildInputs = [ pkg-config ];
-  buildInputs = [ glib libxcb cairo pango python37Packages.xcffib ];
+    SETUPTOOLS_SCM_PRETEND_VERSION = version;
 
-  pythonPath = with python37Packages; [
-    xcffib
-    cairocffi-xcffib
-    setuptools
-    setuptools-scm
-    python-dateutil
-    dbus-python
-    mpd2
-    psutil
-    pyxdg
-    pygobject3
-  ];
+    nativeBuildInputs = [
+      pkg-config
+    ] ++ (with pythonPackages; [
+      setuptools-scm
+    ]);
 
-  postInstall = ''
-    wrapProgram $out/bin/qtile \
-      --run 'export QTILE_WRAPPER=$0' \
-      --run 'export QTILE_SAVED_PYTHONPATH=$PYTHONPATH' \
-      --run 'export QTILE_SAVED_PATH=$PATH'
-  '';
+    propagatedBuildInputs = with pythonPackages; [
+      xcffib
+      (enabled-xcffib cairocffi)
+      setuptools
+      python-dateutil
+      dbus-python
+      mpd2
+      psutil
+      pyxdg
+      pygobject3
+    ];
 
-  doCheck = false; # Requires X server #TODO this can be worked out with the existing NixOS testing infrastructure.
+    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 ];
+    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; };
+  })