1{ 2 config, 3 lib, 4 pkgs, 5 utils, 6 ... 7}: 8 9with lib; 10 11let 12 13 xcfg = config.services.xserver; 14 cfg = xcfg.desktopManager.mate; 15 16in 17 18{ 19 options = { 20 21 services.xserver.desktopManager.mate = { 22 enable = mkOption { 23 type = types.bool; 24 default = false; 25 description = "Enable the MATE desktop environment"; 26 }; 27 28 debug = mkEnableOption "mate-session debug messages"; 29 30 extraPanelApplets = mkOption { 31 default = [ ]; 32 example = literalExpression "with pkgs.mate; [ mate-applets ]"; 33 type = types.listOf types.package; 34 description = "Extra applets to add to mate-panel."; 35 }; 36 37 extraCajaExtensions = mkOption { 38 default = [ ]; 39 example = lib.literalExpression "with pkgs.mate; [ caja-extensions ]"; 40 type = types.listOf types.package; 41 description = "Extra extensions to add to caja."; 42 }; 43 44 enableWaylandSession = mkEnableOption "MATE Wayland session"; 45 }; 46 47 environment.mate.excludePackages = mkOption { 48 default = [ ]; 49 example = literalExpression "[ pkgs.mate.mate-terminal pkgs.mate.pluma ]"; 50 type = types.listOf types.package; 51 description = "Which MATE packages to exclude from the default environment"; 52 }; 53 54 }; 55 56 config = mkMerge [ 57 (mkIf (cfg.enable || cfg.enableWaylandSession) { 58 services.displayManager.sessionPackages = [ 59 pkgs.mate.mate-session-manager 60 ]; 61 62 # Debugging 63 environment.sessionVariables.MATE_SESSION_DEBUG = mkIf cfg.debug "1"; 64 65 environment.systemPackages = utils.removePackagesByName ( 66 pkgs.mate.basePackages 67 ++ pkgs.mate.extraPackages 68 ++ [ 69 (pkgs.mate.caja-with-extensions.override { 70 extensions = cfg.extraCajaExtensions; 71 }) 72 (pkgs.mate.mate-panel-with-applets.override { 73 applets = cfg.extraPanelApplets; 74 }) 75 pkgs.desktop-file-utils 76 pkgs.glib 77 pkgs.gtk3.out 78 pkgs.shared-mime-info 79 pkgs.xdg-user-dirs # Update user dirs as described in https://freedesktop.org/wiki/Software/xdg-user-dirs/ 80 pkgs.yelp # for 'Contents' in 'Help' menus 81 ] 82 ) config.environment.mate.excludePackages; 83 84 programs.dconf.enable = true; 85 # Shell integration for VTE terminals 86 programs.bash.vteIntegration = mkDefault true; 87 programs.zsh.vteIntegration = mkDefault true; 88 89 # Mate uses this for printing 90 programs.system-config-printer.enable = (mkIf config.services.printing.enable (mkDefault true)); 91 92 services.gnome.at-spi2-core.enable = true; 93 services.gnome.glib-networking.enable = true; 94 services.gnome.gnome-keyring.enable = true; 95 services.udev.packages = [ pkgs.mate.mate-settings-daemon ]; 96 services.gvfs.enable = true; 97 services.upower.enable = config.powerManagement.enable; 98 services.libinput.enable = mkDefault true; 99 100 security.pam.services.mate-screensaver.unixAuth = true; 101 102 xdg.portal.configPackages = mkDefault [ pkgs.mate.mate-desktop ]; 103 104 environment.pathsToLink = [ "/share" ]; 105 }) 106 (mkIf cfg.enableWaylandSession { 107 programs.wayfire.enable = true; 108 programs.wayfire.plugins = [ pkgs.wayfirePlugins.firedecor ]; 109 110 environment.sessionVariables.NIX_GSETTINGS_OVERRIDES_DIR = "${pkgs.mate.mate-gsettings-overrides}/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas"; 111 112 environment.systemPackages = [ pkgs.mate.mate-wayland-session ]; 113 services.displayManager.sessionPackages = [ pkgs.mate.mate-wayland-session ]; 114 }) 115 ]; 116}