2014-04-14 16:26:48 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2014-02-07 00:37:17 +01:00
|
|
|
|
2014-04-14 16:26:48 +02:00
|
|
|
with lib;
|
2014-02-07 00:37:17 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.xserver.desktopManager.gnome3;
|
2014-05-19 00:17:13 +02:00
|
|
|
gnome3 = config.environment.gnome3.packageSet;
|
2014-04-11 00:28:15 +02:00
|
|
|
|
|
|
|
# Remove packages of ys from xs, based on their names
|
|
|
|
removePackagesByName = xs: ys:
|
|
|
|
let
|
|
|
|
pkgName = drv: (builtins.parseDrvName drv.name).name;
|
2014-05-19 00:17:13 +02:00
|
|
|
ysNames = map pkgName ys;
|
2014-04-11 00:28:15 +02:00
|
|
|
res = (filter (x: !(builtins.elem (pkgName x) ysNames)) xs);
|
|
|
|
in
|
|
|
|
filter (x: !(builtins.elem (pkgName x) ysNames)) xs;
|
|
|
|
|
2014-04-19 23:44:49 +02:00
|
|
|
# Prioritize nautilus by default when opening directories
|
|
|
|
mimeAppsList = pkgs.writeTextFile {
|
|
|
|
name = "gnome-mimeapps";
|
|
|
|
destination = "/share/applications/mimeapps.list";
|
|
|
|
text = ''
|
|
|
|
[Default Applications]
|
2015-04-10 17:02:57 +02:00
|
|
|
inode/directory=nautilus.desktop;org.gnome.Nautilus.desktop
|
2014-04-19 23:44:49 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2015-07-29 16:27:09 +02:00
|
|
|
nixos-gsettings-desktop-schemas = pkgs.stdenv.mkDerivation {
|
|
|
|
name = "nixos-gsettings-desktop-schemas";
|
|
|
|
buildInputs = [ pkgs.nixos-artwork ];
|
|
|
|
buildCommand = ''
|
|
|
|
mkdir -p $out/share/nixos-gsettings-schemas/nixos-gsettings-desktop-schemas
|
|
|
|
cp -rf ${gnome3.gsettings_desktop_schemas}/share/gsettings-schemas/gsettings-desktop-schemas*/glib-2.0 $out/share/nixos-gsettings-schemas/nixos-gsettings-desktop-schemas/
|
|
|
|
chmod -R a+w $out/share/nixos-gsettings-schemas/nixos-gsettings-desktop-schemas
|
2015-07-30 18:05:14 +02:00
|
|
|
cat - > $out/share/nixos-gsettings-schemas/nixos-gsettings-desktop-schemas/glib-2.0/schemas/nixos-defaults.gschema.override <<- EOF
|
2015-07-29 16:27:09 +02:00
|
|
|
[org.gnome.desktop.background]
|
|
|
|
picture-uri='${pkgs.nixos-artwork}/share/artwork/gnome/Gnome_Dark.png'
|
2015-07-30 18:05:14 +02:00
|
|
|
|
2015-07-29 16:27:09 +02:00
|
|
|
[org.gnome.desktop.screensaver]
|
|
|
|
picture-uri='${pkgs.nixos-artwork}/share/artwork/gnome/Gnome_Dark.png'
|
|
|
|
EOF
|
|
|
|
${pkgs.glib}/bin/glib-compile-schemas $out/share/nixos-gsettings-schemas/nixos-gsettings-desktop-schemas/glib-2.0/schemas/
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2014-02-07 00:37:17 +01:00
|
|
|
in {
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.xserver.desktopManager.gnome3.enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
example = true;
|
|
|
|
description = "Enable Gnome 3 desktop manager.";
|
|
|
|
};
|
|
|
|
|
2014-08-14 21:03:42 +02:00
|
|
|
services.xserver.desktopManager.gnome3.sessionPath = mkOption {
|
|
|
|
default = [];
|
2014-08-27 23:41:15 +02:00
|
|
|
example = literalExample "[ pkgs.gnome3.gpaste ]";
|
2014-08-14 21:03:42 +02:00
|
|
|
description = "Additional list of packages to be added to the session search path.
|
|
|
|
Useful for gnome shell extensions or gsettings-conditionated autostart.";
|
2015-07-24 11:50:46 +02:00
|
|
|
apply = list: list ++ [ gnome3.gnome_shell gnome3.gnome-shell-extensions ];
|
2014-08-14 21:03:42 +02:00
|
|
|
};
|
|
|
|
|
2014-05-19 00:17:13 +02:00
|
|
|
environment.gnome3.packageSet = mkOption {
|
2014-09-23 14:01:25 +02:00
|
|
|
default = null;
|
2015-05-18 10:48:05 +02:00
|
|
|
example = literalExample "pkgs.gnome3_16";
|
2014-11-14 22:45:26 +01:00
|
|
|
description = "Which GNOME 3 package set to use.";
|
2014-09-23 14:01:25 +02:00
|
|
|
apply = p: if p == null then pkgs.gnome3 else p;
|
2014-05-19 00:17:13 +02:00
|
|
|
};
|
|
|
|
|
2014-04-09 00:02:20 +02:00
|
|
|
environment.gnome3.excludePackages = mkOption {
|
|
|
|
default = [];
|
2014-08-27 23:41:15 +02:00
|
|
|
example = literalExample "[ pkgs.gnome3.totem ]";
|
2014-04-09 00:02:20 +02:00
|
|
|
type = types.listOf types.package;
|
|
|
|
description = "Which packages gnome should exclude from the default environment";
|
|
|
|
};
|
|
|
|
|
2014-02-07 00:37:17 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
|
|
|
# Enable helpful DBus services.
|
|
|
|
security.polkit.enable = true;
|
|
|
|
services.udisks2.enable = true;
|
2014-04-06 21:20:45 +02:00
|
|
|
services.accounts-daemon.enable = true;
|
2014-04-24 23:32:32 +02:00
|
|
|
services.geoclue2.enable = mkDefault true;
|
2014-04-08 22:44:22 +02:00
|
|
|
services.gnome3.at-spi2-core.enable = true;
|
2014-04-08 13:23:12 +02:00
|
|
|
services.gnome3.evolution-data-server.enable = true;
|
2014-04-21 00:19:00 +02:00
|
|
|
services.gnome3.gnome-documents.enable = mkDefault true;
|
2014-04-11 00:41:51 +02:00
|
|
|
services.gnome3.gnome-keyring.enable = true;
|
2014-04-12 19:45:12 +02:00
|
|
|
services.gnome3.gnome-online-accounts.enable = mkDefault true;
|
2014-04-11 23:13:31 +02:00
|
|
|
services.gnome3.gnome-user-share.enable = mkDefault true;
|
2014-05-26 00:37:36 +02:00
|
|
|
services.gnome3.gvfs.enable = true;
|
2014-04-20 00:47:55 +02:00
|
|
|
services.gnome3.seahorse.enable = mkDefault true;
|
2014-04-10 23:31:37 +02:00
|
|
|
services.gnome3.sushi.enable = mkDefault true;
|
2014-04-09 15:57:02 +02:00
|
|
|
services.gnome3.tracker.enable = mkDefault true;
|
2014-04-16 18:27:19 +02:00
|
|
|
hardware.pulseaudio.enable = mkDefault true;
|
2014-04-10 23:31:37 +02:00
|
|
|
services.telepathy.enable = mkDefault true;
|
2014-09-12 13:49:51 +02:00
|
|
|
networking.networkmanager.enable = mkDefault true;
|
2014-02-07 00:37:17 +01:00
|
|
|
services.upower.enable = config.powerManagement.enable;
|
2015-04-10 17:02:57 +02:00
|
|
|
hardware.bluetooth.enable = mkDefault true;
|
2015-08-13 01:39:11 +02:00
|
|
|
services.xserver.displayManager.desktopManagerHandlesLidAndPower = false; # true doesn't make sense here, GNOME just doesn't handle it anymore
|
2014-02-07 00:37:17 +01:00
|
|
|
|
2014-10-24 11:50:35 +02:00
|
|
|
fonts.fonts = [ pkgs.dejavu_fonts pkgs.cantarell_fonts ];
|
2014-02-07 00:37:17 +01:00
|
|
|
|
|
|
|
services.xserver.desktopManager.session = singleton
|
|
|
|
{ name = "gnome3";
|
|
|
|
start = ''
|
|
|
|
# Set GTK_DATA_PREFIX so that GTK+ can find the themes
|
|
|
|
export GTK_DATA_PREFIX=${config.system.path}
|
|
|
|
|
|
|
|
# find theme engines
|
2014-02-19 16:53:08 +01:00
|
|
|
export GTK_PATH=${config.system.path}/lib/gtk-3.0:${config.system.path}/lib/gtk-2.0
|
2014-02-07 00:37:17 +01:00
|
|
|
|
|
|
|
export XDG_MENU_PREFIX=gnome
|
|
|
|
|
2014-08-14 21:03:42 +02:00
|
|
|
${concatMapStrings (p: ''
|
|
|
|
if [ -d "${p}/share/gsettings-schemas/${p.name}" ]; then
|
|
|
|
export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${p}/share/gsettings-schemas/${p.name}
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d "${p}/lib/girepository-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
|
|
|
|
'') cfg.sessionPath}
|
|
|
|
|
2014-04-19 23:44:49 +02:00
|
|
|
# Override default mimeapps
|
2014-08-14 21:03:42 +02:00
|
|
|
export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${mimeAppsList}/share
|
2014-04-11 15:03:32 +02:00
|
|
|
|
2015-07-29 16:27:09 +02:00
|
|
|
# Override gsettings-desktop-schema
|
|
|
|
export XDG_DATA_DIRS=${nixos-gsettings-desktop-schemas}/share/nixos-gsettings-schemas/nixos-gsettings-desktop-schemas''${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS
|
|
|
|
|
2014-05-28 17:07:40 +02:00
|
|
|
# Let nautilus find extensions
|
|
|
|
export NAUTILUS_EXTENSION_DIR=${config.system.path}/lib/nautilus/extensions-3.0/
|
|
|
|
|
2015-02-10 17:26:06 +01:00
|
|
|
# Find the mouse
|
|
|
|
export XCURSOR_PATH=~/.icons:${config.system.path}/share/icons
|
|
|
|
|
2014-04-16 15:01:11 +02:00
|
|
|
# Update user dirs as described in http://freedesktop.org/wiki/Software/xdg-user-dirs/
|
|
|
|
${pkgs.xdg-user-dirs}/bin/xdg-user-dirs-update
|
|
|
|
|
2015-04-10 17:02:57 +02:00
|
|
|
# Find the mouse
|
|
|
|
export XCURSOR_PATH=~/.icons:${config.system.path}/share/icons
|
|
|
|
|
2014-02-07 00:37:17 +01:00
|
|
|
${gnome3.gnome_session}/bin/gnome-session&
|
|
|
|
waitPID=$!
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2014-04-04 23:21:38 +02:00
|
|
|
environment.variables.GIO_EXTRA_MODULES = [ "${gnome3.dconf}/lib/gio/modules"
|
2014-05-26 00:37:36 +02:00
|
|
|
"${gnome3.glib_networking}/lib/gio/modules"
|
|
|
|
"${gnome3.gvfs}/lib/gio/modules" ];
|
2015-04-28 02:35:43 +02:00
|
|
|
environment.systemPackages = gnome3.corePackages ++ cfg.sessionPath
|
|
|
|
++ (removePackagesByName gnome3.optionalPackages config.environment.gnome3.excludePackages);
|
2014-04-15 00:15:20 +02:00
|
|
|
|
2015-04-10 17:02:57 +02:00
|
|
|
# Use the correct gnome3 packageSet
|
|
|
|
networking.networkmanager.basePackages =
|
|
|
|
{ inherit (pkgs) networkmanager modemmanager wpa_supplicant;
|
|
|
|
inherit (gnome3) networkmanager_openvpn networkmanager_vpnc
|
|
|
|
networkmanager_openconnect networkmanager_pptp
|
|
|
|
networkmanager_l2tp; };
|
|
|
|
|
2014-04-15 00:15:20 +02:00
|
|
|
# Needed for themes and backgrounds
|
|
|
|
environment.pathsToLink = [ "/share" ];
|
|
|
|
|
2014-02-07 00:37:17 +01:00
|
|
|
};
|
|
|
|
|
2014-02-16 21:37:18 +01:00
|
|
|
|
2014-02-07 00:37:17 +01:00
|
|
|
}
|