1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6
7 # Remove packages of ys from xs, based on their names
8 removePackagesByName = xs: ys:
9 let
10 pkgName = drv: (builtins.parseDrvName drv.name).name;
11 ysNames = map pkgName ys;
12 in
13 filter (x: !(builtins.elem (pkgName x) ysNames)) xs;
14
15 xcfg = config.services.xserver;
16 cfg = xcfg.desktopManager.lxqt;
17
18in
19
20{
21 options = {
22
23 services.xserver.desktopManager.lxqt.enable = mkOption {
24 type = types.bool;
25 default = false;
26 description = "Enable the LXQt desktop manager";
27 };
28
29 environment.lxqt.excludePackages = mkOption {
30 default = [];
31 example = literalExample "[ pkgs.lxqt.qterminal ]";
32 type = types.listOf types.package;
33 description = "Which LXQt packages to exclude from the default environment";
34 };
35
36 };
37
38 config = mkIf (xcfg.enable && cfg.enable) {
39
40 services.xserver.desktopManager.session = singleton {
41 name = "lxqt";
42 bgSupport = true;
43 start = ''
44 exec ${pkgs.lxqt.lxqt-common}/bin/startlxqt
45 '';
46 };
47
48 environment.systemPackages =
49 pkgs.lxqt.preRequisitePackages ++
50 pkgs.lxqt.corePackages ++
51 (removePackagesByName
52 pkgs.lxqt.optionalPackages
53 config.environment.lxqt.excludePackages);
54
55 # Link some extra directories in /run/current-system/software/share
56 environment.pathsToLink = [
57 "/share/desktop-directories"
58 "/share/icons"
59 "/share/lxqt"
60 ];
61
62 environment.variables.GIO_EXTRA_MODULES = [ "${pkgs.gvfs}/lib/gio/modules" ];
63
64 };
65
66}