2020-04-24 23:36:52 +00:00
{ config , lib , pkgs , . . . }:
with lib ;
let
addToXDGDirs = p : ''
if [ - d " ${ p } / s h a r e / g s e t t i n g s - s c h e m a s / ${ p . name } " ] ; then
export XDG_DATA_DIRS = $ XDG_DATA_DIRS'' $ { XDG_DATA_DIRS : + : } $ { p } /share/gsettings-schemas / $ { p . name }
fi
if [ - d " ${ p } / l i b / g i r e p o s i t o r y - 1 . 0 " ] ; then
export GI_TYPELIB_PATH = $ GI_TYPELIB_PATH'' $ { GI_TYPELIB_PATH : + : } $ { p } /lib/girepository-1.0
export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH'' $ { LD_LIBRARY_PATH : + : } $ { p } /lib
fi
'' ;
xcfg = config . services . xserver ;
cfg = xcfg . desktopManager . mate ;
in
{
options = {
services . xserver . desktopManager . mate = {
enable = mkOption {
type = types . bool ;
default = false ;
description = " E n a b l e t h e M A T E d e s k t o p e n v i r o n m e n t " ;
} ;
debug = mkEnableOption " m a t e - s e s s i o n d e b u g m e s s a g e s " ;
} ;
environment . mate . excludePackages = mkOption {
default = [ ] ;
2021-10-06 13:57:05 +00:00
example = literalExpression " [ p k g s . m a t e . m a t e - t e r m i n a l p k g s . m a t e . p l u m a ] " ;
2020-04-24 23:36:52 +00:00
type = types . listOf types . package ;
description = " W h i c h M A T E p a c k a g e s t o e x c l u d e f r o m t h e d e f a u l t e n v i r o n m e n t " ;
} ;
} ;
config = mkIf cfg . enable {
services . xserver . displayManager . sessionPackages = [
pkgs . mate . mate-session-manager
] ;
services . xserver . displayManager . sessionCommands = ''
if test " $ X D G _ C U R R E N T _ D E S K T O P " = " M A T E " ; then
export XDG_MENU_PREFIX = mate-
# Let caja find extensions
export CAJA_EXTENSION_DIRS = $ CAJA_EXTENSION_DIRS'' $ { CAJA_EXTENSION_DIRS : + : } $ { config . system . path } /lib/caja/extensions-2.0
# Let caja extensions find gsettings schemas
$ { concatMapStrings ( p : ''
if [ - d " ${ p } / l i b / c a j a / e x t e n s i o n s - 2 . 0 " ] ; then
$ { addToXDGDirs p }
fi
'' ) c o n f i g . e n v i r o n m e n t . s y s t e m P a c k a g e s }
# 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)
$ { addToXDGDirs pkgs . mate . mate-control-center }
fi
'' ;
# Let mate-panel find applets
environment . sessionVariables . " M A T E _ P A N E L _ A P P L E T S _ D I R " = " ${ config . system . path } / s h a r e / m a t e - p a n e l / a p p l e t s " ;
environment . sessionVariables . " M A T E _ P A N E L _ E X T R A _ M O D U L E S " = " ${ config . system . path } / l i b / m a t e - p a n e l / a p p l e t s " ;
# Debugging
environment . sessionVariables . MATE_SESSION_DEBUG = mkIf cfg . debug " 1 " ;
environment . systemPackages =
pkgs . mate . basePackages ++
2021-05-20 23:08:51 +00:00
( pkgs . gnome . removePackagesByName
2020-04-24 23:36:52 +00:00
pkgs . mate . extraPackages
config . environment . mate . excludePackages ) ++
[
pkgs . desktop-file-utils
pkgs . glib
pkgs . gtk3 . out
pkgs . shared-mime-info
pkgs . xdg-user-dirs # Update user dirs as described in https://freedesktop.org/wiki/Software/xdg-user-dirs/
pkgs . mate . mate-settings-daemon
pkgs . yelp # for 'Contents' in 'Help' menus
] ;
programs . dconf . enable = true ;
# Shell integration for VTE terminals
programs . bash . vteIntegration = mkDefault true ;
programs . zsh . vteIntegration = mkDefault true ;
# Mate uses this for printing
programs . system-config-printer . enable = ( mkIf config . services . printing . enable ( mkDefault true ) ) ;
2021-05-20 23:08:51 +00:00
services . gnome . at-spi2-core . enable = true ;
services . gnome . gnome-keyring . enable = true ;
2020-04-24 23:36:52 +00:00
services . udev . packages = [ pkgs . mate . mate-settings-daemon ] ;
services . gvfs . enable = true ;
services . upower . enable = config . powerManagement . enable ;
security . pam . services . mate-screensaver . unixAuth = true ;
environment . pathsToLink = [ " / s h a r e " ] ;
} ;
}