1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 7 addToXDGDirs = p: '' 8 if [ -d "${p}/share/gsettings-schemas/${p.name}" ]; then 9 export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${p}/share/gsettings-schemas/${p.name} 10 fi 11 12 if [ -d "${p}/lib/girepository-1.0" ]; then 13 export GI_TYPELIB_PATH=$GI_TYPELIB_PATH''${GI_TYPELIB_PATH:+:}${p}/lib/girepository-1.0 14 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${p}/lib 15 fi 16 ''; 17 18 xcfg = config.services.xserver; 19 cfg = xcfg.desktopManager.mate; 20 21in 22 23{ 24 options = { 25 26 services.xserver.desktopManager.mate = { 27 enable = mkOption { 28 type = types.bool; 29 default = false; 30 description = "Enable the MATE desktop environment"; 31 }; 32 33 debug = mkEnableOption "mate-session debug messages"; 34 }; 35 36 environment.mate.excludePackages = mkOption { 37 default = []; 38 example = literalExample "[ pkgs.mate.mate-terminal pkgs.mate.pluma ]"; 39 type = types.listOf types.package; 40 description = "Which MATE packages to exclude from the default environment"; 41 }; 42 43 }; 44 45 config = mkIf cfg.enable { 46 47 services.xserver.displayManager.sessionPackages = [ 48 pkgs.mate.mate-session-manager 49 ]; 50 51 services.xserver.displayManager.sessionCommands = '' 52 if test "$XDG_CURRENT_DESKTOP" = "MATE"; then 53 export XDG_MENU_PREFIX=mate- 54 55 # Let caja find extensions 56 export CAJA_EXTENSION_DIRS=$CAJA_EXTENSION_DIRS''${CAJA_EXTENSION_DIRS:+:}${config.system.path}/lib/caja/extensions-2.0 57 58 # Let caja extensions find gsettings schemas 59 ${concatMapStrings (p: '' 60 if [ -d "${p}/lib/caja/extensions-2.0" ]; then 61 ${addToXDGDirs p} 62 fi 63 '') config.environment.systemPackages} 64 65 # Add mate-control-center paths to some XDG variables because its schemas are needed by mate-settings-daemon, and mate-settings-daemon is a dependency for mate-control-center (that is, they are mutually recursive) 66 ${addToXDGDirs pkgs.mate.mate-control-center} 67 fi 68 ''; 69 70 # Let mate-panel find applets 71 environment.sessionVariables."MATE_PANEL_APPLETS_DIR" = "${config.system.path}/share/mate-panel/applets"; 72 environment.sessionVariables."MATE_PANEL_EXTRA_MODULES" = "${config.system.path}/lib/mate-panel/applets"; 73 74 # Debugging 75 environment.sessionVariables.MATE_SESSION_DEBUG = mkIf cfg.debug "1"; 76 77 environment.systemPackages = 78 pkgs.mate.basePackages ++ 79 (pkgs.gnome.removePackagesByName 80 pkgs.mate.extraPackages 81 config.environment.mate.excludePackages) ++ 82 [ 83 pkgs.desktop-file-utils 84 pkgs.glib 85 pkgs.gtk3.out 86 pkgs.shared-mime-info 87 pkgs.xdg-user-dirs # Update user dirs as described in https://freedesktop.org/wiki/Software/xdg-user-dirs/ 88 pkgs.mate.mate-settings-daemon 89 pkgs.yelp # for 'Contents' in 'Help' menus 90 ]; 91 92 programs.dconf.enable = true; 93 # Shell integration for VTE terminals 94 programs.bash.vteIntegration = mkDefault true; 95 programs.zsh.vteIntegration = mkDefault true; 96 97 # Mate uses this for printing 98 programs.system-config-printer.enable = (mkIf config.services.printing.enable (mkDefault true)); 99 100 services.gnome.at-spi2-core.enable = true; 101 services.gnome.gnome-keyring.enable = true; 102 services.udev.packages = [ pkgs.mate.mate-settings-daemon ]; 103 services.gvfs.enable = true; 104 services.upower.enable = config.powerManagement.enable; 105 106 security.pam.services.mate-screensaver.unixAuth = true; 107 108 environment.pathsToLink = [ "/share" ]; 109 }; 110 111}