d9fa88dfe8
Fixes issue #33231 and makes it possible to enable Plasma and KDE at the same time. Previously, this worked like this: - The gdk-pixbuf package comes with a cache file covering the modules bundled with gdk-pixbuf. - The librsvg package comes with a cache covering modules from gdk-pixbuf as well as librsvg. - plasma5 and xfce modules set the environment variable GDK_PIXBUF_MODULE_FILE to the one from librsvg, so that SVG was supported in addition to the formats supported by gdk-pixbuf. However if both were enabled a configuration conflict would result (despite setting to the same value). While this sort of worked (ignoring the conflict which perhaps could be hacked around), it is unscalable and a hack, as there would be a real problem when one wanted to add a third package that supports additional image formats. A new NixOS module (gdk-pixbuf) is added with a configuration option (modulePackages) that other modules use to request specific packages to be included in the loaders cache. When any package is present in the list, the module generates a system-wide loaders cache which includes the requested packages (and always gdk-pixbuf itself), and sets the environment variable GDK_PIXBUF_MODULE_FILE to point to the generated cache file. The plasma5 and xfce modules are updated to add librsvg to modulePackages instead of setting GDK_PIXBUF_MODULE_FILE. Note that many packages create wrappers that set GDK_PIXBUF_MODULE_FILE, some directly to the one from librsvg. Therefore this change does not change the existing hack in the librsvg package which ensures that file is generated. This change aims only to solve the conflict in the global environent variable configuration.
144 lines
3.7 KiB
Nix
144 lines
3.7 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.services.xserver.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 cfg.enable {
|
|
environment.systemPackages = with pkgs.xfce // pkgs; [
|
|
# Get GTK+ themes and gtk-update-icon-cache
|
|
gtk2.out
|
|
|
|
# Supplies some abstract icons such as:
|
|
# utilities-terminal, accessories-text-editor
|
|
gnome3.defaultIconTheme
|
|
|
|
hicolor-icon-theme
|
|
tango-icon-theme
|
|
xfce4-icon-theme
|
|
|
|
desktop-file-utils
|
|
shared-mime-info
|
|
|
|
# Needed by Xfce's xinitrc script
|
|
# TODO: replace with command -v
|
|
which
|
|
|
|
exo
|
|
garcon
|
|
gtk-xfce-engine
|
|
gvfs
|
|
libxfce4ui
|
|
tumbler
|
|
xfconf
|
|
|
|
mousepad
|
|
ristretto
|
|
xfce4-appfinder
|
|
xfce4-screenshooter
|
|
xfce4-session
|
|
xfce4-settings
|
|
xfce4-terminal
|
|
|
|
(thunar.override { thunarPlugins = cfg.thunarPlugins; })
|
|
thunar-volman # TODO: drop
|
|
] ++ (if config.hardware.pulseaudio.enable
|
|
then [ xfce4-mixer-pulse xfce4-volumed-pulse ]
|
|
else [ xfce4-mixer xfce4-volumed ])
|
|
# TODO: NetworkManager doesn't belong here
|
|
++ optionals config.networking.networkmanager.enable [ networkmanagerapplet ]
|
|
++ optionals config.powerManagement.enable [ xfce4-power-manager ]
|
|
++ optionals cfg.enableXfwm [ xfwm4 ]
|
|
++ optionals (!cfg.noDesktop) [
|
|
xfce4-panel
|
|
xfce4-notifyd
|
|
xfdesktop
|
|
];
|
|
|
|
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" ];
|
|
};
|
|
|
|
services.xserver.gdk-pixbuf.modulePackages = [ pkgs.librsvg ];
|
|
|
|
services.xserver.desktopManager.session = [{
|
|
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.runtimeShell} ${pkgs.xfce.xinitrc} &
|
|
waitPID=$!
|
|
'';
|
|
}];
|
|
|
|
services.xserver.updateDbusEnvironment = true;
|
|
|
|
# Enable helpful DBus services.
|
|
services.udisks2.enable = true;
|
|
services.upower.enable = config.powerManagement.enable;
|
|
};
|
|
}
|