2017-08-31 05:16:51 +02:00
{ config , lib , pkgs , . . . }:
with lib ;
let
2018-01-04 17:04:57 +01:00
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
'' ;
2017-08-31 05:16:51 +02:00
xcfg = config . services . xserver ;
cfg = xcfg . desktopManager . mate ;
in
{
options = {
2017-12-25 02:12:31 +01:00
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 " ;
2017-08-31 05:16:51 +02:00
} ;
environment . mate . excludePackages = mkOption {
default = [ ] ;
2021-10-03 18:06:03 +02: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 ] " ;
2017-08-31 05:16:51 +02: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 " ;
} ;
} ;
2019-05-13 06:12:00 +02:00
config = mkIf cfg . enable {
2017-08-31 05:16:51 +02:00
2020-02-13 23:32:12 +01:00
services . xserver . displayManager . sessionPackages = [
pkgs . mate . mate-session-manager
] ;
2017-08-31 05:16:51 +02:00
2020-02-13 23:32:12 +01:00
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-
2018-01-08 17:49:23 +01:00
2020-02-13 23:32:12 +01:00
# 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 : ''
2018-01-08 17:49:23 +01:00
if [ - d " ${ p } / l i b / c a j a / e x t e n s i o n s - 2 . 0 " ] ; then
2020-02-13 23:32:12 +01:00
$ { addToXDGDirs p }
2018-01-08 17:49:23 +01:00
fi
2020-02-13 23:32:12 +01:00
'' ) 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 }
2018-01-04 17:12:49 +01:00
2020-02-13 23:32:12 +01:00
# 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
'' ;
2018-01-04 17:04:57 +01:00
2020-02-13 23:32:12 +01:00
# 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 " ;
2017-08-31 05:16:51 +02:00
2020-02-18 22:34:26 +01:00
# Debugging
environment . sessionVariables . MATE_SESSION_DEBUG = mkIf cfg . debug " 1 " ;
2017-09-01 22:27:24 +02:00
environment . systemPackages =
2017-08-31 05:16:51 +02:00
pkgs . mate . basePackages ++
2021-05-07 23:18:14 +02:00
( pkgs . gnome . removePackagesByName
2017-08-31 05:16:51 +02:00
pkgs . mate . extraPackages
2019-03-03 10:12:12 +01:00
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/
2019-09-30 00:51:15 +02:00
pkgs . mate . mate-settings-daemon
2020-02-14 22:31:52 +01:00
pkgs . yelp # for 'Contents' in 'Help' menus
2019-03-03 10:12:12 +01:00
] ;
programs . dconf . enable = true ;
2019-08-21 22:21:55 +02:00
# Shell integration for VTE terminals
programs . bash . vteIntegration = mkDefault true ;
programs . zsh . vteIntegration = mkDefault true ;
2019-09-06 15:49:17 +02:00
# Mate uses this for printing
programs . system-config-printer . enable = ( mkIf config . services . printing . enable ( mkDefault true ) ) ;
2021-05-07 23:18:14 +02:00
services . gnome . at-spi2-core . enable = true ;
services . gnome . gnome-keyring . enable = true ;
2019-09-30 00:51:15 +02:00
services . udev . packages = [ pkgs . mate . mate-settings-daemon ] ;
2019-08-20 00:53:43 +02:00
services . gvfs . enable = true ;
2017-10-04 13:23:46 +02:00
services . upower . enable = config . powerManagement . enable ;
2017-08-31 05:16:51 +02:00
2019-08-13 23:52:01 +02:00
security . pam . services . mate-screensaver . unixAuth = true ;
2018-04-01 18:27:55 +02:00
2017-08-31 18:25:44 +02:00
environment . pathsToLink = [ " / s h a r e " ] ;
2017-08-31 05:16:51 +02:00
} ;
}