nixpkgs-suyu/nixos/modules/services/x11/desktop-managers/xfce.nix
Wei Tang 62a974bbbf xfce: delay package selection for pulseaudio volume to nixos modules (#23382)
Now there are separate `xfce4.xfce4mixer_pulse` and `xfce4.xfcevolumed_pulse` attributes for PulseAudio versions of these packages, instead of relying on Nixpkgs option. Mind that xfce4-volumed and xfce4-volumed-pulse are actually two separate programs without much overlap.
2017-12-19 22:28:12 +03:00

138 lines
4.1 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
xcfg = config.services.xserver;
pcfg = config.hardware.pulseaudio;
cfg = xcfg.desktopManager.xfce;
in
{
options = {
services.xserver.desktopManager.xfce = {
enable = mkOption {
type = types.bool;
default = false;
description = "Enable the Xfce desktop environment.";
};
thunarPlugins = mkOption {
default = [];
type = types.listOf types.package;
example = literalExample "[ pkgs.xfce.thunar-archive-plugin ]";
description = ''
A list of plugin that should be installed with Thunar.
'';
};
noDesktop = mkOption {
type = types.bool;
default = false;
description = "Don't install XFCE desktop components (xfdesktop, panel and notification daemon).";
};
extraSessionCommands = mkOption {
default = "";
type = types.lines;
description = ''
Shell commands executed just before XFCE is started.
'';
};
enableXfwm = mkOption {
type = types.bool;
default = true;
description = "Enable the XFWM (default) window manager.";
};
screenLock = mkOption {
type = types.enum [ "xscreensaver" "xlockmore" "slock" ];
default = "xlockmore";
description = "Application used by XFCE to lock the screen.";
};
};
};
config = mkIf (xcfg.enable && cfg.enable) {
services.xserver.desktopManager.session = singleton
{ name = "xfce";
bgSupport = true;
start =
''
${cfg.extraSessionCommands}
# Set GTK_PATH so that GTK+ can find the theme engines.
export GTK_PATH="${config.system.path}/lib/gtk-2.0:${config.system.path}/lib/gtk-3.0"
# Set GTK_DATA_PREFIX so that GTK+ can find the Xfce themes.
export GTK_DATA_PREFIX=${config.system.path}
${pkgs.stdenv.shell} ${pkgs.xfce.xinitrc} &
waitPID=$!
'';
};
services.xserver.updateDbusEnvironment = true;
environment.systemPackages =
[ pkgs.gtk2.out # To get GTK+'s themes and gtk-update-icon-cache
pkgs.hicolor_icon_theme
pkgs.tango-icon-theme
pkgs.shared_mime_info
pkgs.which # Needed by the xfce's xinitrc script.
pkgs."${cfg.screenLock}"
pkgs.xfce.exo
pkgs.xfce.gtk_xfce_engine
pkgs.xfce.mousepad
pkgs.xfce.ristretto
pkgs.xfce.terminal
(pkgs.xfce.thunar.override { thunarPlugins = cfg.thunarPlugins; })
pkgs.xfce.xfce4icontheme
pkgs.xfce.xfce4session
pkgs.xfce.xfce4settings
(if pcfg.enable then pkgs.xfce.xfce4mixer_pulse else pkgs.xfce.xfce4mixer)
(if pcfg.enable then pkgs.xfce.xfce4volumed_pulse else pkgs.xfce.xfce4volumed)
pkgs.xfce.xfce4-screenshooter
pkgs.xfce.xfconf
# This supplies some "abstract" icons such as
# "utilities-terminal" and "accessories-text-editor".
pkgs.gnome3.defaultIconTheme
pkgs.desktop_file_utils
pkgs.xfce.libxfce4ui
pkgs.xfce.garcon
pkgs.xfce.thunar_volman
pkgs.xfce.gvfs
pkgs.xfce.xfce4_appfinder
pkgs.xfce.tumbler # found via dbus
]
++ optional cfg.enableXfwm pkgs.xfce.xfwm4
++ optional config.powerManagement.enable pkgs.xfce.xfce4_power_manager
++ optional config.networking.networkmanager.enable pkgs.networkmanagerapplet
++ optionals (!cfg.noDesktop)
[ pkgs.xfce.xfce4panel
pkgs.xfce.xfdesktop
pkgs.xfce.xfce4notifyd # found via dbus
];
environment.pathsToLink =
[ "/share/xfce4" "/share/themes" "/share/mime" "/share/desktop-directories" "/share/gtksourceview-2.0" ];
environment.variables.GIO_EXTRA_MODULES = [ "${pkgs.xfce.gvfs}/lib/gio/modules" ];
environment.variables.GDK_PIXBUF_MODULE_FILE = [
"$(echo ${pkgs.librsvg.out}/lib/gdk-pixbuf-*/*/loaders.cache)"
];
# Enable helpful DBus services.
services.udisks2.enable = true;
services.upower.enable = config.powerManagement.enable;
};
}