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 = { 16 enable = mkOption { 17 type = types.bool; 18 default = false; 19 description = "Enable the Xfce desktop environment."; 20 }; 21 22 thunarPlugins = mkOption { 23 default = []; 24 type = types.listOf types.package; 25 example = literalExample "[ pkgs.xfce.thunar-archive-plugin ]"; 26 description = '' 27 A list of plugin that should be installed with Thunar. 28 ''; 29 }; 30 31 noDesktop = mkOption { 32 type = types.bool; 33 default = false; 34 description = "Don't install XFCE desktop components (xfdesktop, panel and notification daemon)."; 35 }; 36 37 extraSessionCommands = mkOption { 38 default = ""; 39 type = types.lines; 40 description = '' 41 Shell commands executed just before XFCE is started. 42 ''; 43 }; 44 }; 45 46 }; 47 48 49 config = mkIf (xcfg.enable && cfg.enable) { 50 51 services.xserver.desktopManager.session = singleton 52 { name = "xfce"; 53 bgSupport = true; 54 start = 55 '' 56 ${cfg.extraSessionCommands} 57 58 # Set GTK_PATH so that GTK+ can find the theme engines. 59 export GTK_PATH="${config.system.path}/lib/gtk-2.0:${config.system.path}/lib/gtk-3.0" 60 61 # Set GTK_DATA_PREFIX so that GTK+ can find the Xfce themes. 62 export GTK_DATA_PREFIX=${config.system.path} 63 64 ${pkgs.stdenv.shell} ${pkgs.xfce.xinitrc} & 65 waitPID=$! 66 ''; 67 }; 68 69 services.xserver.updateDbusEnvironment = true; 70 71 environment.systemPackages = 72 [ pkgs.gtk # To get GTK+'s themes. 73 pkgs.hicolor_icon_theme 74 pkgs.tango-icon-theme 75 pkgs.shared_mime_info 76 pkgs.which # Needed by the xfce's xinitrc script. 77 pkgs.xfce.exo 78 pkgs.xfce.gtk_xfce_engine 79 pkgs.xfce.mousepad 80 pkgs.xfce.ristretto 81 pkgs.xfce.terminal 82 (pkgs.xfce.thunar.override { thunarPlugins = cfg.thunarPlugins; }) 83 pkgs.xfce.xfce4icontheme 84 pkgs.xfce.xfce4session 85 pkgs.xfce.xfce4settings 86 pkgs.xfce.xfce4mixer 87 pkgs.xfce.xfce4volumed 88 pkgs.xfce.xfce4-screenshooter 89 pkgs.xfce.xfconf 90 pkgs.xfce.xfwm4 91 # This supplies some "abstract" icons such as 92 # "utilities-terminal" and "accessories-text-editor". 93 pkgs.gnome3.defaultIconTheme 94 pkgs.desktop_file_utils 95 pkgs.xfce.libxfce4ui 96 pkgs.xfce.garcon 97 pkgs.xfce.thunar_volman 98 pkgs.xfce.gvfs 99 pkgs.xfce.xfce4_appfinder 100 pkgs.xfce.tumbler # found via dbus 101 ] 102 ++ optional config.powerManagement.enable pkgs.xfce.xfce4_power_manager 103 ++ optionals (!cfg.noDesktop) 104 [ pkgs.xfce.xfce4panel 105 pkgs.xfce.xfdesktop 106 pkgs.xfce.xfce4notifyd # found via dbus 107 ]; 108 109 environment.pathsToLink = 110 [ "/share/xfce4" "/share/themes" "/share/mime" "/share/desktop-directories" "/share/gtksourceview-2.0" ]; 111 112 environment.variables.GIO_EXTRA_MODULES = [ "${pkgs.xfce.gvfs}/lib/gio/modules" ]; 113 114 # Enable helpful DBus services. 115 services.udisks2.enable = true; 116 services.upower.enable = config.powerManagement.enable; 117 118 }; 119 120}