1 { config, lib, pkgs, utils, ... }:
6 cfg = config.services.xserver.desktopManager.xfce;
7 excludePackages = config.environment.xfce.excludePackages;
12 maintainers = teams.xfce.members;
17 # needed to preserve some semblance of UI familarity
18 # with original XFCE module
19 (mkRenamedOptionModule
20 [ "services" "xserver" "desktopManager" "xfce4-14" "extraSessionCommands" ]
21 [ "services" "xserver" "displayManager" "sessionCommands" ])
24 # xfce4-14 module removed and promoted to xfce.
25 # Needed for configs that used xfce4-14 module to migrate to this one.
26 (mkRenamedOptionModule
27 [ "services" "xserver" "desktopManager" "xfce4-14" "enable" ]
28 [ "services" "xserver" "desktopManager" "xfce" "enable" ])
29 (mkRenamedOptionModule
30 [ "services" "xserver" "desktopManager" "xfce4-14" "noDesktop" ]
31 [ "services" "xserver" "desktopManager" "xfce" "noDesktop" ])
32 (mkRenamedOptionModule
33 [ "services" "xserver" "desktopManager" "xfce4-14" "enableXfwm" ]
34 [ "services" "xserver" "desktopManager" "xfce" "enableXfwm" ])
35 (mkRenamedOptionModule
36 [ "services" "xserver" "desktopManager" "xfce" "extraSessionCommands" ]
37 [ "services" "xserver" "displayManager" "sessionCommands" ])
38 (mkRemovedOptionModule [ "services" "xserver" "desktopManager" "xfce" "screenLock" ] "")
41 # thunar has its own module
42 (mkRenamedOptionModule
43 [ "services" "xserver" "desktopManager" "xfce" "thunarPlugins" ]
44 [ "programs" "thunar" "plugins" ])
48 services.xserver.desktopManager.xfce = {
52 description = "Enable the Xfce desktop environment.";
55 noDesktop = mkOption {
58 description = "Don't install XFCE desktop components (xfdesktop and panel).";
61 enableXfwm = mkOption {
64 description = "Enable the XFWM (default) window manager.";
67 enableScreensaver = mkOption {
70 description = "Enable the XFCE screensaver.";
74 environment.xfce.excludePackages = mkOption {
76 example = literalExpression "[ pkgs.xfce.xfce4-volumed-pulse ]";
77 type = types.listOf types.package;
78 description = "Which packages XFCE should exclude from the default environment";
82 config = mkIf cfg.enable {
83 environment.systemPackages = utils.removePackagesByName (with pkgs.xfce // pkgs; [
85 gtk3.out # gtk-update-icon-cache
94 shared-mime-info # for update-mime-database
96 # For a polkit authentication agent
99 # Needed by Xfce's xinitrc script
100 xdg-user-dirs # Update user dirs as described in https://freedesktop.org/wiki/Software/xdg-user-dirs/
116 ] # TODO: NetworkManager doesn't belong here
117 ++ optional config.networking.networkmanager.enable networkmanagerapplet
118 ++ optional config.powerManagement.enable xfce4-power-manager
119 ++ optionals (config.hardware.pulseaudio.enable || config.services.pipewire.pulse.enable) [
121 # volume up/down keys support:
122 # xfce4-pulseaudio-plugin includes all the functionalities of xfce4-volumed-pulse
123 # but can only be used with xfce4-panel, so for no-desktop usage we still include
124 # xfce4-volumed-pulse
125 (if cfg.noDesktop then xfce4-volumed-pulse else xfce4-pulseaudio-plugin)
126 ] ++ optionals cfg.enableXfwm [
129 ] ++ optionals (!cfg.noDesktop) [
132 ] ++ optional cfg.enableScreensaver xfce4-screensaver) excludePackages;
134 programs.gnupg.agent.pinentryPackage = mkDefault pkgs.pinentry-gtk2;
135 programs.xfconf.enable = true;
136 programs.thunar.enable = true;
138 environment.pathsToLink = [
141 "/share/gtksourceview-3.0"
142 "/share/gtksourceview-4.0"
145 services.xserver.desktopManager.session = [{
147 desktopNames = [ "XFCE" ];
148 bgSupport = !cfg.noDesktop;
150 ${pkgs.runtimeShell} ${pkgs.xfce.xfce4-session.xinitrc} &
155 services.xserver.updateDbusEnvironment = true;
156 programs.gdk-pixbuf.modulePackages = [ pkgs.librsvg ];
158 # Enable helpful DBus services.
159 services.udisks2.enable = true;
160 security.polkit.enable = true;
161 services.accounts-daemon.enable = true;
162 services.upower.enable = config.powerManagement.enable;
163 services.gnome.glib-networking.enable = true;
164 services.gvfs.enable = true;
165 services.tumbler.enable = true;
166 services.system-config-printer.enable = (mkIf config.services.printing.enable (mkDefault true));
167 services.libinput.enable = mkDefault true; # used in xfce4-settings-manager
168 services.colord.enable = mkDefault true;
170 # Enable default programs
171 programs.dconf.enable = true;
173 # Shell integration for VTE terminals
174 programs.bash.vteIntegration = mkDefault true;
175 programs.zsh.vteIntegration = mkDefault true;
178 systemd.packages = utils.removePackagesByName (with pkgs.xfce; [
182 security.pam.services.xfce4-screensaver.unixAuth = cfg.enableScreensaver;
184 xdg.portal.configPackages = mkDefault [ pkgs.xfce.xfce4-session ];