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