1{
2 config,
3 lib,
4 pkgs,
5 utils,
6 ...
7}:
8
9with lib;
10
11let
12 xcfg = config.services.xserver;
13 cfg = xcfg.desktopManager.lxqt;
14
15in
16
17{
18 meta = {
19 maintainers = teams.lxqt.members;
20 };
21
22 options = {
23
24 services.xserver.desktopManager.lxqt.enable = mkOption {
25 type = types.bool;
26 default = false;
27 description = "Enable the LXQt desktop manager";
28 };
29
30 environment.lxqt.excludePackages = mkOption {
31 default = [ ];
32 example = literalExpression "[ pkgs.lxqt.qterminal ]";
33 type = types.listOf types.package;
34 description = "Which LXQt packages to exclude from the default environment";
35 };
36
37 };
38
39 config = mkIf cfg.enable {
40
41 services.xserver.desktopManager.session = singleton {
42 name = "lxqt";
43 bgSupport = true;
44 start = ''
45 # Upstream installs default configuration files in
46 # $prefix/share/lxqt instead of $prefix/etc/xdg, (arguably)
47 # giving distributors freedom to ship custom default
48 # configuration files more easily. In order to let the session
49 # manager find them the share subdirectory is added to the
50 # XDG_CONFIG_DIRS environment variable.
51 #
52 # For an explanation see
53 # https://github.com/lxqt/lxqt/issues/1521#issuecomment-405097453
54 #
55 export XDG_CONFIG_DIRS=$XDG_CONFIG_DIRS''${XDG_CONFIG_DIRS:+:}${config.system.path}/share
56
57 exec ${pkgs.lxqt.lxqt-session}/bin/startlxqt
58 '';
59 };
60
61 environment.systemPackages =
62 pkgs.lxqt.preRequisitePackages
63 ++ pkgs.lxqt.corePackages
64 ++ (utils.removePackagesByName pkgs.lxqt.optionalPackages config.environment.lxqt.excludePackages);
65
66 # Link some extra directories in /run/current-system/software/share
67 environment.pathsToLink = [ "/share" ];
68
69 programs.gnupg.agent.pinentryPackage = mkDefault pkgs.pinentry-qt;
70
71 # virtual file systems support for PCManFM-QT
72 services.gvfs.enable = true;
73
74 services.upower.enable = config.powerManagement.enable;
75
76 services.libinput.enable = mkDefault true;
77
78 xdg.portal.lxqt.enable = mkDefault true;
79
80 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1050804
81 xdg.portal.config.lxqt.default = mkDefault [
82 "lxqt"
83 "gtk"
84 ];
85 };
86
87}