1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6
7 xcfg = config.services.xserver;
8 cfg = xcfg.desktopManager.xfce;
9
10in
11
12{
13 options = {
14
15 services.xserver.desktopManager.xfce.enable = mkOption {
16 type = types.bool;
17 default = false;
18 description = "Enable the Xfce desktop environment.";
19 };
20
21 };
22
23
24 config = mkIf (xcfg.enable && cfg.enable) {
25
26 services.xserver.desktopManager.session = singleton
27 { name = "xfce";
28 bgSupport = true;
29 start =
30 ''
31 # Set GTK_PATH so that GTK+ can find the theme engines.
32 export GTK_PATH="${config.system.path}/lib/gtk-2.0:${config.system.path}/lib/gtk-3.0"
33
34 # Set GTK_DATA_PREFIX so that GTK+ can find the Xfce themes.
35 export GTK_DATA_PREFIX=${config.system.path}
36
37 exec ${pkgs.stdenv.shell} ${pkgs.xfce.xinitrc}
38 '';
39 };
40
41 environment.systemPackages =
42 [ pkgs.gtk # To get GTK+'s themes.
43 pkgs.hicolor_icon_theme
44 pkgs.tango-icon-theme
45 pkgs.shared_mime_info
46 pkgs.which # Needed by the xfce's xinitrc script.
47 pkgs.xfce.exo
48 pkgs.xfce.gtk_xfce_engine
49 pkgs.xfce.mousepad
50 pkgs.xfce.ristretto
51 pkgs.xfce.terminal
52 pkgs.xfce.thunar
53 pkgs.xfce.xfce4icontheme
54 pkgs.xfce.xfce4panel
55 pkgs.xfce.xfce4session
56 pkgs.xfce.xfce4settings
57 pkgs.xfce.xfce4mixer
58 pkgs.xfce.xfce4volumed
59 pkgs.xfce.xfce4screenshooter
60 pkgs.xfce.xfconf
61 pkgs.xfce.xfdesktop
62 pkgs.xfce.xfwm4
63 # This supplies some "abstract" icons such as
64 # "utilities-terminal" and "accessories-text-editor".
65 pkgs.gnome3.defaultIconTheme
66 pkgs.desktop_file_utils
67 pkgs.xfce.libxfce4ui
68 pkgs.xfce.garcon
69 pkgs.xfce.thunar_volman
70 pkgs.xfce.gvfs
71 pkgs.xfce.xfce4_appfinder
72 pkgs.xfce.tumbler # found via dbus
73 pkgs.xfce.xfce4notifyd # found via dbus
74 ]
75 ++ optional config.powerManagement.enable pkgs.xfce.xfce4_power_manager;
76
77 environment.pathsToLink =
78 [ "/share/xfce4" "/share/themes" "/share/mime" "/share/desktop-directories" "/share/gtksourceview-2.0" ];
79
80 environment.variables.GIO_EXTRA_MODULES = [ "${pkgs.xfce.gvfs}/lib/gio/modules" ];
81
82 # Enable helpful DBus services.
83 services.udisks2.enable = true;
84 services.upower.enable = config.powerManagement.enable;
85
86 };
87
88}