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