Merge pull request #316239 from arjan-s/qtile-sessions

qtile: install proper session .desktop files for both xorg and wayland
This commit is contained in:
Pol Dellaiera 2024-06-15 19:57:54 +02:00 committed by GitHub
commit 7938d40a60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 20 additions and 39 deletions

View File

@ -7,6 +7,10 @@ let
in
{
imports = [
(mkRemovedOptionModule [ "services" "xserver" "windowManager" "qtile" "backend" ] "The qtile package now provides separate display sessions for both X11 and Wayland.")
];
options.services.xserver.windowManager.qtile = {
enable = mkEnableOption "qtile";
@ -22,14 +26,6 @@ in
'';
};
backend = mkOption {
type = types.enum [ "x11" "wayland" ];
default = "x11";
description = ''
Backend to use in qtile: `x11` or `wayland`.
'';
};
extraPackages = mkOption {
type = types.functionTo (types.listOf types.package);
default = _: [];
@ -57,25 +53,14 @@ in
};
config = mkIf cfg.enable {
services.xserver.windowManager.qtile.finalPackage = pkgs.python3.withPackages (p:
[ (cfg.package.unwrapped or cfg.package) ] ++ (cfg.extraPackages p)
);
services = {
xserver.windowManager.qtile.finalPackage = pkgs.python3.pkgs.qtile.override { extraPackages = cfg.extraPackages pkgs.python3.pkgs; };
displayManager.sessionPackages = [ cfg.finalPackage ];
};
services.xserver.windowManager.session = [{
name = "qtile";
start = ''
${cfg.finalPackage}/bin/qtile start -b ${cfg.backend} \
${optionalString (cfg.configFile != null)
"--config \"${cfg.configFile}\""} &
waitPID=$!
'';
}];
environment.systemPackages = [
# pkgs.qtile is currently a buildenv of qtile and its dependencies.
# For userland commands, we want the underlying package so that
# packages such as python don't bleed into userland and overwrite intended behavior.
(cfg.package.unwrapped or cfg.package)
];
environment = {
etc."xdg/qtile/config.py" = mkIf (cfg.configFile != null) { source = cfg.configFile; };
systemPackages = [ cfg.finalPackage ];
};
};
}

View File

@ -10,7 +10,7 @@ import ./make-test-python.nix ({ lib, ...} : {
test-support.displayManager.auto.user = "alice";
services.xserver.windowManager.qtile.enable = true;
services.displayManager.defaultSession = lib.mkForce "none+qtile";
services.displayManager.defaultSession = lib.mkForce "qtile";
environment.systemPackages = [ pkgs.kitty ];
};

View File

@ -30,6 +30,7 @@
xcffib,
xkbcommon,
nixosTests,
extraPackages ? [ ],
}:
buildPythonPackage rec {
@ -66,7 +67,7 @@ buildPythonPackage rec {
pkg-config
];
dependencies = [
dependencies = extraPackages ++ [
(cairocffi.override { withXcffib = true; })
dbus-next
iwlib
@ -97,6 +98,11 @@ buildPythonPackage rec {
providedSessions = [ "qtile" ];
};
postInstall = ''
install resources/qtile.desktop -Dt $out/share/xsessions
install resources/qtile-wayland.desktop -Dt $out/share/wayland-sessions
'';
meta = with lib; {
homepage = "http://www.qtile.org/";
license = licenses.mit;

View File

@ -1,8 +0,0 @@
{ python3 }:
(python3.withPackages (_: [ python3.pkgs.qtile ])).overrideAttrs (_: {
# restore some qtile attrs, beautify name
inherit (python3.pkgs.qtile) pname version meta;
name = with python3.pkgs.qtile; "${pname}-${version}";
passthru.unwrapped = python3.pkgs.qtile;
})

View File

@ -35074,8 +35074,6 @@ with pkgs;
qpdfview = libsForQt5.callPackage ../applications/office/qpdfview { };
qtile = callPackage ../development/python-modules/qtile/wrapper.nix { };
vimgolf = callPackage ../games/vimgolf { };
vimpc = callPackage ../applications/audio/vimpc { };