This repository has no description
3.3 kB
108 lines
1{ pkgs, lib, ... }:
2let
3 qtile = (pkgs.python3.pkgs.qtile.override {
4 pulsectl-asyncio = pkgs.python3.pkgs.pulsectl-asyncio.overrideAttrs (oldAttrs: {
5 postPatch = ''
6 substituteInPlace setup.cfg --replace "pulsectl >=23.5.0,<=24.11.0" "pulsectl >=23.5.0"
7 '';
8 });
9 extraPackages = [
10 pkgs.python3.pkgs.dbus-fast
11 ];
12 }).overrideAttrs (oldAttrs: {
13 pname = "qtile-0.31.0";
14 version = "0.31.0";
15 src = pkgs.fetchFromGitHub {
16 owner = "qtile";
17 repo = "qtile";
18 tag = "v0.31.0";
19 hash = "sha256-EqrvBXigMjevPERTcz3EXSRaZP2xSEsOxjuiJ/5QOz0=";
20 };
21 });
22 # qtile-extras = pkgs.python3.pkgs.qtile-extras.override {
23 # qtile = qtile;
24 # };
25in
26{
27 imports = [
28 ../lib/wayland.nix
29 ];
30
31 environment.sessionVariables.XDG_CURRENT_DESKTOP = "qtile";
32 services.greetd.enable = true;
33
34 security.pam.services.swaylock = {};
35 security.pam.services.swaylock.fprintAuth = true;
36
37 # For greetd, we need a shell script into path, which lets us start qtile.service (after importing the environment of the login shell).
38 services.greetd.settings.default_session.command = "${pkgs.greetd.tuigreet}/bin/tuigreet --remember --cmd ${pkgs.writeScript "startqtile" ''
39 #! ${pkgs.bash}/bin/bash
40
41 # first import environment variables from the login manager
42 export XDG_DATA_DIRS=/run/current-system/sw/share/gsettings-schemas:$XDG_DATA_DIRS
43 systemctl --user unset-environment DISPLAY WAYLAND_DISPLAY
44 systemctl --user import-environment XDG_DATA_DIRS PATH
45 # then start the service
46 exec systemctl --user --wait start qtile.service
47 ''}";
48
49 systemd.user.targets.qtile-session = {
50 description = "Qtile compositor session";
51 documentation = [ "man:systemd.special(7)" ];
52 bindsTo = [ "graphical-session.target" ];
53 wants = [ "graphical-session-pre.target" ];
54 after = [ "graphical-session-pre.target" ];
55 };
56
57 environment.systemPackages = [
58 qtile
59 pkgs.copyq
60 pkgs.coreutils
61 ];
62
63 systemd.user.services.qtile =
64 let
65 pyEnv = pkgs.python3.withPackages (_p: [
66 qtile
67 # qtile-extras
68 pkgs.python3.pkgs.iwlib
69 ]);
70 in
71 {
72 description = "Qtile - Wayland window manager";
73 documentation = [ "man:qtile(5)" ];
74 bindsTo = [ "graphical-session.target" ];
75 wants = [ "graphical-session-pre.target" ];
76 after = [ "graphical-session-pre.target" ];
77 # We explicitly unset PATH here, as we want it to be set by
78 # systemctl --user import-environment in startqtile
79 environment.PATH = lib.mkForce null;
80 environment.PYTHONPATH = lib.mkForce null;
81 environment.PYTHONTRACEMALLOC = "1";
82 serviceConfig = {
83 Type = "simple";
84 ExecStart = "${pyEnv}/bin/qtile start -b wayland -c /etc/qtile.py";
85 Restart = "on-failure";
86 RestartSec = 1;
87 TimeoutStopSec = 10;
88 };
89 };
90
91 environment.etc."qtile.py".source = ./qtile.py;
92
93 systemd.user.services.xwayland-satellite = {
94 wantedBy = [ "graphical-session.target" ];
95 serviceConfig = {
96 RestartSec = 5;
97 ExecStart = "${pkgs.xwayland}/bin/xwayland-satellite";
98 };
99 };
100
101 systemd.user.services.copyq = {
102 wantedBy = [ "graphical-session.target" ];
103 serviceConfig = {
104 RestartSec = 5;
105 ExecStart = "${pkgs.copyq}/bin/copyq";
106 };
107 };
108}