Skip to content

Commit

Permalink
Merge pull request #316239 from arjan-s/qtile-sessions
Browse files Browse the repository at this point in the history
qtile: install proper session .desktop files for both xorg and wayland
  • Loading branch information
drupol authored Jun 15, 2024
2 parents b754f87 + 50643d3 commit 7938d40
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 39 deletions.
39 changes: 12 additions & 27 deletions nixos/modules/services/x11/window-managers/qtile.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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 = _: [];
Expand Down Expand Up @@ -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.session = [{
name = "qtile";
start = ''
${cfg.finalPackage}/bin/qtile start -b ${cfg.backend} \
${optionalString (cfg.configFile != null)
"--config \"${cfg.configFile}\""} &
waitPID=$!
'';
}];
services = {
xserver.windowManager.qtile.finalPackage = pkgs.python3.pkgs.qtile.override { extraPackages = cfg.extraPackages pkgs.python3.pkgs; };
displayManager.sessionPackages = [ cfg.finalPackage ];
};

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 ];
};
};
}
2 changes: 1 addition & 1 deletion nixos/tests/qtile.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];
};
Expand Down
8 changes: 7 additions & 1 deletion pkgs/development/python-modules/qtile/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
xcffib,
xkbcommon,
nixosTests,
extraPackages ? [ ],
}:

buildPythonPackage rec {
Expand Down Expand Up @@ -66,7 +67,7 @@ buildPythonPackage rec {
pkg-config
];

dependencies = [
dependencies = extraPackages ++ [
(cairocffi.override { withXcffib = true; })
dbus-next
iwlib
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 0 additions & 8 deletions pkgs/development/python-modules/qtile/wrapper.nix

This file was deleted.

2 changes: 0 additions & 2 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 { };
Expand Down

0 comments on commit 7938d40

Please sign in to comment.