2017-08-31 04:16:51 +01:00
{ config , lib , pkgs , . . . }:
with lib ;
let
2018-01-04 16:04:57 +00: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 04:16:51 +01:00
xcfg = config . services . xserver ;
cfg = xcfg . desktopManager . mate ;
in
{
options = {
2017-12-25 01:12:31 +00: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 04:16:51 +01:00
} ;
environment . mate . excludePackages = mkOption {
default = [ ] ;
example = literalExample " [ 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 ] " ;
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 05:12:00 +01:00
config = mkIf cfg . enable {
2017-08-31 04:16:51 +01:00
services . xserver . desktopManager . session = singleton {
name = " m a t e " ;
bgSupport = true ;
start = ''
# Set GTK_DATA_PREFIX so that GTK+ can find the themes
export GTK_DATA_PREFIX = $ { config . system . path }
# Find theme engines
export GTK_PATH = $ { config . system . path } /lib/gtk-3.0 : $ { config . system . path } /lib/gtk-2.0
2017-12-24 21:32:08 +00:00
export XDG_MENU_PREFIX = mate-
2017-08-31 04:16:51 +01:00
2018-01-08 16:49:23 +00: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 : ''
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
'' )
config . environment . systemPackages
}
2018-01-04 16:12:49 +00:00
# Let mate-panel find applets
export MATE_PANEL_APPLETS_DIR = $ MATE_PANEL_APPLETS_DIR'' $ { MATE_PANEL_APPLETS_DIR : + : } $ { config . system . path } /share/mate-panel/applets
export MATE_PANEL_EXTRA_MODULES = $ MATE_PANEL_EXTRA_MODULES'' $ { MATE_PANEL_EXTRA_MODULES : + : } $ { config . system . path } /lib/mate-panel/applets
2018-01-04 16:04:57 +00: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 }
2017-12-25 01:12:31 +00:00
$ { pkgs . mate . mate-session-manager } /bin/mate-session $ { optionalString cfg . debug " - - d e b u g " } &
2017-08-31 04:16:51 +01:00
waitPID = $ !
'' ;
} ;
2017-09-01 21:27:24 +01:00
environment . systemPackages =
2017-08-31 04:16:51 +01:00
pkgs . mate . basePackages ++
2019-01-16 23:03:55 +00:00
( pkgs . gnome3 . removePackagesByName
2017-08-31 04:16:51 +01:00
pkgs . mate . extraPackages
2019-03-03 09:12:12 +00: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/
] ;
programs . dconf . enable = true ;
services . gnome3 . at-spi2-core . enable = true ;
2017-08-31 04:16:51 +01:00
services . gnome3 . gnome-keyring . enable = true ;
2019-03-03 09:02:25 +00:00
services . gnome3 . gnome-settings-daemon . enable = true ;
services . gnome3 . gnome-settings-daemon . package = pkgs . mate . mate-settings-daemon ;
2019-02-28 14:24:37 +00:00
services . gnome3 . gvfs . enable = true ;
2017-10-04 12:23:46 +01:00
services . upower . enable = config . powerManagement . enable ;
2017-08-31 04:16:51 +01:00
2018-04-01 17:27:55 +01:00
security . pam . services . " m a t e - s c r e e n s a v e r " . unixAuth = true ;
2019-02-28 14:24:37 +00:00
environment . variables . GIO_EXTRA_MODULES = [ " ${ pkgs . gnome3 . gvfs } / l i b / g i o / m o d u l e s " ] ;
2017-08-31 17:25:44 +01:00
environment . pathsToLink = [ " / s h a r e " ] ;
2017-08-31 04:16:51 +01:00
} ;
}