feat(pkgs): package latest qtile commit

This commit is contained in:
Infinidoge 2022-09-14 18:08:03 -04:00
parent 710f3c21ac
commit 37f3f88309
7 changed files with 148 additions and 0 deletions

View file

@ -15,4 +15,5 @@ channels: final: prev: {
hydrus
;
qtile = final.qtile-unstable;
}

View file

@ -17,5 +17,24 @@
"type": "github"
},
"version": "v0.1.0"
},
"qtile": {
"cargoLocks": null,
"extract": null,
"name": "qtile",
"passthru": null,
"pinned": false,
"src": {
"deepClone": false,
"fetchSubmodules": false,
"leaveDotGit": false,
"name": null,
"owner": "qtile",
"repo": "qtile",
"rev": "62b9e5951d5d9c2f5e9c9a1fcb595696ed16d71d",
"sha256": "sha256-wlfmTUtdvj6akzXj8JK/950cRQkv/z/fRKqCff4GvmE=",
"type": "github"
},
"version": "62b9e5951d5d9c2f5e9c9a1fcb595696ed16d71d"
}
}

View file

@ -12,4 +12,15 @@
sha256 = "sha256-9CV6B7fRHXl73uI2JRv3RiaFczLHHBOd7/8UoCAwK6w=";
});
};
qtile = {
pname = "qtile";
version = "62b9e5951d5d9c2f5e9c9a1fcb595696ed16d71d";
src = fetchFromGitHub ({
owner = "qtile";
repo = "qtile";
rev = "62b9e5951d5d9c2f5e9c9a1fcb595696ed16d71d";
fetchSubmodules = false;
sha256 = "sha256-wlfmTUtdvj6akzXj8JK/950cRQkv/z/fRKqCff4GvmE=";
});
};
}

View file

@ -8,4 +8,6 @@ final: prev: {
frei = final.callPackage ./frei.nix { source = final.sources.frei; };
nix-modrinth-prefetch = final.callPackage ./nix-modrinth-prefetch.nix { };
qtile-unstable = final.callPackage ./qtile.nix { source = final.sources.qtile; };
}

View file

@ -0,0 +1,22 @@
diff --git a/libqtile/core/lifecycle.py b/libqtile/core/lifecycle.py
index 0d4d119d..c37d1799 100644
--- a/libqtile/core/lifecycle.py
+++ b/libqtile/core/lifecycle.py
@@ -25,7 +25,7 @@ class LifeCycle:
def _atexit(self) -> None:
if self.behavior is Behavior.RESTART:
- argv = [sys.executable] + sys.argv
+ argv = sys.argv
if "--no-spawn" not in argv:
argv.append("--no-spawn")
argv = [s for s in argv if not s.startswith("--with-state")]
@@ -33,7 +33,7 @@ class LifeCycle:
argv.append("--with-state=" + self.state_file)
logger.warning("Restarting Qtile with os.execv(...)")
# No other code will execute after the following line does
- os.execv(sys.executable, argv)
+ os.execv(sys.argv[0], argv)
elif self.behavior is Behavior.TERMINATE:
logger.warning("Qtile will now terminate")
elif self.behavior is Behavior.NONE:

89
pkgs/qtile.nix Normal file
View file

@ -0,0 +1,89 @@
{ lib
, fetchFromGitHub
, python3
, python3Packages
, mypy
, glib
, pango
, pkg-config
, libinput
, libxkbcommon
, wayland
, wlroots
, xcbutilcursor
, source
}:
let
unwrapped = python3Packages.buildPythonPackage rec {
inherit (source) pname version src;
patches = [
./patches/qtile-fix-restart.patch # https://github.com/NixOS/nixpkgs/issues/139568
];
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 python3Packages; [
setuptools-scm
]);
propagatedBuildInputs = with python3Packages; [
xcffib
(cairocffi.override { withXcffib = true; })
setuptools
python-dateutil
dbus-python
dbus-next
mpd2
psutil
pyxdg
pygobject3
pywayland
pywlroots
xkbcommon
];
buildInputs = [
libinput
wayland
wlroots
libxkbcommon
];
# 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
(python3.withPackages (_: [ 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; };
# restore original qtile attrs
inherit (unwrapped) pname version meta;
})

View file

@ -2,3 +2,7 @@
[frei]
src.github = "alexcoder04/frei"
fetch.github = "alexcoder04/frei"
[qtile]
src.git = "https://github.com/qtile/qtile.git"
fetch.github = "qtile/qtile"