qtile: add more options and expose unwrapped package
This commit is contained in:
parent
edc62383e4
commit
1addf91b0b
5 changed files with 124 additions and 85 deletions
|
@ -1,23 +1,63 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.xserver.windowManager.qtile;
|
||||
pyEnv = pkgs.python3.withPackages (p: [ (cfg.package.unwrapped or cfg.package) ] ++ (cfg.extraPackages p));
|
||||
in
|
||||
|
||||
{
|
||||
options.services.xserver.windowManager.qtile = {
|
||||
enable = mkEnableOption (lib.mdDoc "qtile");
|
||||
|
||||
package = mkPackageOptionMD pkgs "qtile" { };
|
||||
package = mkPackageOptionMD pkgs "qtile-unwrapped" { };
|
||||
|
||||
configFile = mkOption {
|
||||
type = with types; nullOr path;
|
||||
default = null;
|
||||
example = literalExpression "./your_config.py";
|
||||
description = lib.mdDoc ''
|
||||
Path to the qtile configuration file.
|
||||
If null, $XDG_CONFIG_HOME/qtile/config.py will be used.
|
||||
'';
|
||||
};
|
||||
|
||||
backend = mkOption {
|
||||
type = types.enum [ "x11" "wayland" ];
|
||||
default = "x11";
|
||||
description = lib.mdDoc ''
|
||||
Backend to use in qtile:
|
||||
<option>x11</option> or <option>wayland</option>.
|
||||
'';
|
||||
};
|
||||
|
||||
extraPackages = mkOption {
|
||||
type = types.functionTo (types.listOf types.package);
|
||||
default = _: [];
|
||||
defaultText = literalExpression ''
|
||||
python3Packages: with python3Packages; [];
|
||||
'';
|
||||
description = lib.mdDoc ''
|
||||
Extra Python packages available to Qtile.
|
||||
An example would be to include `python3Packages.qtile-extras`
|
||||
for additional unoffical widgets.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
python3Packages: with python3Packages; [
|
||||
qtile-extras
|
||||
];
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services.xserver.windowManager.session = [{
|
||||
name = "qtile";
|
||||
start = ''
|
||||
${cfg.package}/bin/qtile start &
|
||||
${pyEnv}/bin/qtile start -b ${cfg.backend} \
|
||||
${optionalString (cfg.configFile != null)
|
||||
"--config \"${cfg.configFile}\""} &
|
||||
waitPID=$!
|
||||
'';
|
||||
}];
|
||||
|
|
|
@ -14,85 +14,74 @@
|
|||
, pulseaudio
|
||||
}:
|
||||
|
||||
let
|
||||
unwrapped = python3Packages.buildPythonPackage rec {
|
||||
pname = "qtile";
|
||||
version = "0.22.1";
|
||||
python3Packages.buildPythonPackage rec {
|
||||
pname = "qtile";
|
||||
version = "0.22.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "qtile";
|
||||
repo = "qtile";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-HOyExVKOqZ4OeNM1/AiXQeiUV+EbSJLEjWEibm07ff8=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./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
|
||||
pulseaudio
|
||||
];
|
||||
|
||||
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 arjan-s ];
|
||||
};
|
||||
src = fetchFromGitHub {
|
||||
owner = "qtile";
|
||||
repo = "qtile";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-HOyExVKOqZ4OeNM1/AiXQeiUV+EbSJLEjWEibm07ff8=";
|
||||
};
|
||||
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;
|
||||
})
|
||||
patches = [
|
||||
./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
|
||||
pulseaudio
|
||||
];
|
||||
|
||||
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 arjan-s ];
|
||||
};
|
||||
}
|
||||
|
|
9
pkgs/applications/window-managers/qtile/wrapper.nix
Normal file
9
pkgs/applications/window-managers/qtile/wrapper.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ python3, qtile-unwrapped }:
|
||||
(python3.withPackages (_: [ qtile-unwrapped ])).overrideAttrs (_: {
|
||||
# otherwise will be exported as "env", this restores `nix search` behavior
|
||||
name = "${qtile-unwrapped.pname}-${qtile-unwrapped.version}";
|
||||
# export underlying qtile package
|
||||
passthru = { unwrapped = qtile-unwrapped; };
|
||||
# restore original qtile attrs
|
||||
inherit (qtile-unwrapped) pname version meta;
|
||||
})
|
|
@ -6,7 +6,7 @@
|
|||
, xorgserver
|
||||
, pulseaudio
|
||||
, pytest-asyncio
|
||||
, qtile
|
||||
, qtile-unwrapped
|
||||
, keyring
|
||||
, requests
|
||||
, stravalib
|
||||
|
@ -34,7 +34,7 @@ buildPythonPackage rec {
|
|||
];
|
||||
checkInputs = [
|
||||
pytest-asyncio
|
||||
qtile.unwrapped
|
||||
qtile-unwrapped
|
||||
pulseaudio
|
||||
keyring
|
||||
requests
|
||||
|
|
|
@ -34077,7 +34077,8 @@ with pkgs;
|
|||
|
||||
qpdfview = libsForQt5.callPackage ../applications/office/qpdfview { };
|
||||
|
||||
qtile = callPackage ../applications/window-managers/qtile { };
|
||||
qtile-unwrapped = callPackage ../applications/window-managers/qtile { };
|
||||
qtile = callPackage ../applications/window-managers/qtile/wrapper.nix { };
|
||||
|
||||
vimgolf = callPackage ../games/vimgolf { };
|
||||
|
||||
|
|
Loading…
Reference in a new issue