This repository has no description
2.1 kB
62 lines
1{ pkgs, lib, ... }:
2{
3 imports = [
4 ../lib/wayland.nix
5 ];
6
7 environment.sessionVariables.XDG_CURRENT_DESKTOP = "qtile";
8 services.greetd.enable = true;
9
10 # For greetd, we need a shell script into path, which lets us start qtile.service (after importing the environment of the login shell).
11 services.greetd.settings.default_session.command = "${pkgs.greetd.tuigreet}/bin/tuigreet --remember --cmd ${pkgs.writeScript "startqtile" ''
12 #! ${pkgs.bash}/bin/bash
13
14 # first import environment variables from the login manager
15 export XDG_DATA_DIRS=/run/current-system/sw/share/gsettings-schemas:$XDG_DATA_DIRS
16 systemctl --user unset-environment DISPLAY WAYLAND_DISPLAY
17 systemctl --user import-environment XDG_DATA_DIRS PATH
18 # then start the service
19 exec systemctl --user --wait start qtile.service
20 ''}";
21
22 systemd.user.targets.qtile-session = {
23 description = "Qtile compositor session";
24 documentation = [ "man:systemd.special(7)" ];
25 bindsTo = [ "graphical-session.target" ];
26 wants = [ "graphical-session-pre.target" ];
27 after = [ "graphical-session-pre.target" ];
28 };
29
30 environment.systemPackages = [
31 pkgs.qtile
32 pkgs.copyq
33 ];
34
35 systemd.user.services.qtile =
36 let
37 pyEnv = pkgs.python3.withPackages (_p: [
38 pkgs.python3.pkgs.qtile
39 pkgs.python3.pkgs.iwlib
40 ]);
41 in
42 {
43 description = "Qtile - Wayland window manager";
44 documentation = [ "man:qtile(5)" ];
45 bindsTo = [ "graphical-session.target" ];
46 wants = [ "graphical-session-pre.target" ];
47 after = [ "graphical-session-pre.target" ];
48 # We explicitly unset PATH here, as we want it to be set by
49 # systemctl --user import-environment in startqtile
50 environment.PATH = lib.mkForce null;
51 environment.PYTHONPATH = lib.mkForce null;
52 serviceConfig = {
53 Type = "simple";
54 ExecStart = "${pyEnv}/bin/qtile start -b wayland -c /etc/qtile.py";
55 Restart = "on-failure";
56 RestartSec = 1;
57 TimeoutStopSec = 10;
58 };
59 };
60
61 environment.etc."qtile.py".source = ./qtile.py;
62}