about summary refs log tree commit diff
path: root/nixos/modules/services/x11/desktop-managers/mate.nix
diff options
context:
space:
mode:
authorromildo <malaquias@gmail.com>2017-08-31 00:16:51 -0300
committerromildo <malaquias@gmail.com>2017-08-31 00:16:51 -0300
commitdcebb0668b7e767095b395267fb0a151e588a2ae (patch)
tree00788c6b4aa1b6a89006461b3d08c8ccfb70506c /nixos/modules/services/x11/desktop-managers/mate.nix
parent934b9bef41d89c418bd92618e042f0852c7b1336 (diff)
mate: add the MATE desktop environment
Diffstat (limited to 'nixos/modules/services/x11/desktop-managers/mate.nix')
-rw-r--r--nixos/modules/services/x11/desktop-managers/mate.nix79
1 files changed, 79 insertions, 0 deletions
diff --git a/nixos/modules/services/x11/desktop-managers/mate.nix b/nixos/modules/services/x11/desktop-managers/mate.nix
new file mode 100644
index 0000000000000..239cd772fc2f9
--- /dev/null
+++ b/nixos/modules/services/x11/desktop-managers/mate.nix
@@ -0,0 +1,79 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+  # Remove packages of ys from xs, based on their names
+  removePackagesByName = xs: ys:
+    let
+      pkgName = drv: (builtins.parseDrvName drv.name).name;
+      ysNames = map pkgName ys;
+    in
+      filter (x: !(builtins.elem (pkgName x) ysNames)) xs;
+
+  xcfg = config.services.xserver;
+  cfg = xcfg.desktopManager.mate;
+
+in
+
+{
+  options = {
+
+    services.xserver.desktopManager.mate.enable = mkOption {
+      type = types.bool;
+      default = false;
+      description = "Enable the MATE desktop environment";
+    };
+
+    environment.mate.excludePackages = mkOption {
+      default = [];
+      example = literalExample "[ pkgs.mate.mate-terminal pkgs.mate.pluma ]";
+      type = types.listOf types.package;
+      description = "Which MATE packages to exclude from the default environment";
+    };
+
+  };
+
+  config = mkIf (xcfg.enable && cfg.enable) {
+
+    services.xserver.desktopManager.session = singleton {
+      name = "mate";
+      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
+
+        export XDG_MENU_PREFIX=mate
+
+        # Find the mouse
+        export XCURSOR_PATH=~/.icons:${config.system.path}/share/icons
+
+        # Update user dirs as described in http://freedesktop.org/wiki/Software/xdg-user-dirs/
+        ${pkgs.xdg-user-dirs}/bin/xdg-user-dirs-update
+
+        ${pkgs.mate.mate-session-manager}/bin/mate-session &
+        waitPID=$!
+      '';
+    };
+
+    environment.systemPackages =
+      pkgs.mate.basePackages ++
+      (removePackagesByName
+        pkgs.mate.extraPackages
+        config.environment.mate.excludePackages);
+
+    services.dbus.packages = [
+      pkgs.gnome3.dconf
+      pkgs.at_spi2_core
+    ];
+
+    services.gnome3.gnome-keyring.enable = true;
+
+    environment.pathsToLink = [ "/share" ];    
+  };
+
+}