2014-04-14 15:26:48 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2014-02-06 23:37:17 +00:00
|
|
|
|
2014-04-14 15:26:48 +01:00
|
|
|
with lib;
|
2014-02-06 23:37:17 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.xserver.desktopManager.gnome3;
|
2014-04-10 23:28:15 +01:00
|
|
|
|
|
|
|
# Remove packages of ys from xs, based on their names
|
|
|
|
removePackagesByName = xs: ys:
|
|
|
|
let
|
|
|
|
pkgName = drv: (builtins.parseDrvName drv.name).name;
|
2014-05-18 23:17:13 +01:00
|
|
|
ysNames = map pkgName ys;
|
2014-04-10 23:28:15 +01:00
|
|
|
in
|
|
|
|
filter (x: !(builtins.elem (pkgName x) ysNames)) xs;
|
|
|
|
|
2014-04-19 22:44:49 +01: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 16:02:57 +01:00
|
|
|
inode/directory=nautilus.desktop;org.gnome.Nautilus.desktop
|
2014-04-19 22:44:49 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2016-09-27 14:26:37 +01:00
|
|
|
nixos-gsettings-desktop-schemas = pkgs.runCommand "nixos-gsettings-desktop-schemas" {}
|
|
|
|
''
|
2015-10-08 13:53:37 +01:00
|
|
|
mkdir -p $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas
|
2018-02-25 02:23:58 +00:00
|
|
|
cp -rf ${pkgs.gnome3.gsettings-desktop-schemas}/share/gsettings-schemas/gsettings-desktop-schemas*/glib-2.0/schemas/*.xml $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas
|
2015-10-08 13:53:37 +01:00
|
|
|
|
|
|
|
${concatMapStrings (pkg: "cp -rf ${pkg}/share/gsettings-schemas/*/glib-2.0/schemas/*.xml $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas\n") cfg.extraGSettingsOverridePackages}
|
|
|
|
|
|
|
|
chmod -R a+w $out/share/gsettings-schemas/nixos-gsettings-overrides
|
|
|
|
cat - > $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas/nixos-defaults.gschema.override <<- EOF
|
2015-07-29 15:27:09 +01:00
|
|
|
[org.gnome.desktop.background]
|
2017-06-07 22:00:58 +01:00
|
|
|
picture-uri='${pkgs.nixos-artwork.wallpapers.gnome-dark}/share/artwork/gnome/Gnome_Dark.png'
|
2015-07-30 17:05:14 +01:00
|
|
|
|
2015-07-29 15:27:09 +01:00
|
|
|
[org.gnome.desktop.screensaver]
|
2017-06-07 22:00:58 +01:00
|
|
|
picture-uri='${pkgs.nixos-artwork.wallpapers.gnome-dark}/share/artwork/gnome/Gnome_Dark.png'
|
2015-10-08 13:53:37 +01:00
|
|
|
|
|
|
|
${cfg.extraGSettingsOverrides}
|
2015-07-29 15:27:09 +01:00
|
|
|
EOF
|
2015-10-08 13:53:37 +01:00
|
|
|
|
2016-04-16 17:57:59 +01:00
|
|
|
${pkgs.glib.dev}/bin/glib-compile-schemas $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas/
|
2015-07-29 15:27:09 +01:00
|
|
|
'';
|
|
|
|
|
2014-02-06 23:37:17 +00:00
|
|
|
in {
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
2015-10-08 13:53:37 +01:00
|
|
|
services.xserver.desktopManager.gnome3 = {
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = "Enable Gnome 3 desktop manager.";
|
|
|
|
};
|
|
|
|
|
2018-07-31 10:01:38 +01:00
|
|
|
sessionPath = mkOption {
|
|
|
|
default = [];
|
|
|
|
example = literalExample "[ pkgs.gnome3.gpaste ]";
|
|
|
|
description = "Additional list of packages to be added to the session search path.
|
|
|
|
Useful for gnome shell extensions or gsettings-conditionated autostart.";
|
|
|
|
apply = list: list ++ [ pkgs.gnome3.gnome-shell pkgs.gnome3.gnome-shell-extensions ];
|
|
|
|
};
|
|
|
|
|
2015-10-08 13:53:37 +01:00
|
|
|
extraGSettingsOverrides = mkOption {
|
|
|
|
default = "";
|
|
|
|
type = types.lines;
|
|
|
|
description = "Additional gsettings overrides.";
|
|
|
|
};
|
|
|
|
|
|
|
|
extraGSettingsOverridePackages = mkOption {
|
|
|
|
default = [];
|
|
|
|
type = types.listOf types.path;
|
|
|
|
description = "List of packages for which gsettings are overridden.";
|
|
|
|
};
|
2016-06-11 15:44:57 +01:00
|
|
|
|
|
|
|
debug = mkEnableOption "gnome-session debug messages";
|
2017-01-31 07:36:35 +00:00
|
|
|
};
|
2014-08-14 20:03:42 +01:00
|
|
|
|
2014-04-08 23:02:20 +01:00
|
|
|
environment.gnome3.excludePackages = mkOption {
|
|
|
|
default = [];
|
2014-08-27 22:41:15 +01:00
|
|
|
example = literalExample "[ pkgs.gnome3.totem ]";
|
2014-04-08 23:02:20 +01:00
|
|
|
type = types.listOf types.package;
|
|
|
|
description = "Which packages gnome should exclude from the default environment";
|
|
|
|
};
|
|
|
|
|
2014-02-06 23:37:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
|
|
|
# Enable helpful DBus services.
|
|
|
|
security.polkit.enable = true;
|
|
|
|
services.udisks2.enable = true;
|
2014-04-06 20:20:45 +01:00
|
|
|
services.accounts-daemon.enable = true;
|
2014-04-24 22:32:32 +01:00
|
|
|
services.geoclue2.enable = mkDefault true;
|
2017-08-30 23:25:09 +01:00
|
|
|
services.dleyna-renderer.enable = mkDefault true;
|
2017-09-01 14:09:45 +01:00
|
|
|
services.dleyna-server.enable = mkDefault true;
|
2014-04-08 21:44:22 +01:00
|
|
|
services.gnome3.at-spi2-core.enable = true;
|
2014-04-08 12:23:12 +01:00
|
|
|
services.gnome3.evolution-data-server.enable = true;
|
2017-05-06 18:40:37 +01:00
|
|
|
services.gnome3.gnome-disks.enable = mkDefault true;
|
2014-04-20 23:19:00 +01:00
|
|
|
services.gnome3.gnome-documents.enable = mkDefault true;
|
2014-04-10 23:41:51 +01:00
|
|
|
services.gnome3.gnome-keyring.enable = true;
|
2014-04-12 18:45:12 +01:00
|
|
|
services.gnome3.gnome-online-accounts.enable = mkDefault true;
|
2016-09-30 16:02:52 +01:00
|
|
|
services.gnome3.gnome-terminal-server.enable = mkDefault true;
|
2014-04-11 22:13:31 +01:00
|
|
|
services.gnome3.gnome-user-share.enable = mkDefault true;
|
2014-05-25 23:37:36 +01:00
|
|
|
services.gnome3.gvfs.enable = true;
|
2014-04-19 23:47:55 +01:00
|
|
|
services.gnome3.seahorse.enable = mkDefault true;
|
2014-04-10 22:31:37 +01:00
|
|
|
services.gnome3.sushi.enable = mkDefault true;
|
2014-04-09 14:57:02 +01:00
|
|
|
services.gnome3.tracker.enable = mkDefault true;
|
2017-11-09 13:28:43 +00:00
|
|
|
services.gnome3.tracker-miners.enable = mkDefault true;
|
2014-04-16 17:27:19 +01:00
|
|
|
hardware.pulseaudio.enable = mkDefault true;
|
2014-04-10 22:31:37 +01:00
|
|
|
services.telepathy.enable = mkDefault true;
|
2014-09-12 12:49:51 +01:00
|
|
|
networking.networkmanager.enable = mkDefault true;
|
2014-02-06 23:37:17 +00:00
|
|
|
services.upower.enable = config.powerManagement.enable;
|
2016-06-21 22:52:49 +01:00
|
|
|
services.dbus.packages = mkIf config.services.printing.enable [ pkgs.system-config-printer ];
|
2016-06-22 13:43:15 +01:00
|
|
|
services.colord.enable = mkDefault true;
|
2016-06-16 20:19:12 +01:00
|
|
|
services.packagekit.enable = mkDefault true;
|
2015-04-10 16:02:57 +01:00
|
|
|
hardware.bluetooth.enable = mkDefault true;
|
2016-07-14 22:05:15 +01:00
|
|
|
services.xserver.libinput.enable = mkDefault true; # for controlling touchpad settings via gnome control center
|
2018-02-25 02:23:58 +00:00
|
|
|
services.udev.packages = [ pkgs.gnome3.gnome-settings-daemon ];
|
2017-05-17 13:52:32 +01:00
|
|
|
systemd.packages = [ pkgs.gnome3.vino ];
|
2018-02-13 01:09:51 +00:00
|
|
|
services.flatpak.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
|
2014-02-06 23:37:17 +00:00
|
|
|
|
2017-01-31 07:36:35 +00:00
|
|
|
# If gnome3 is installed, build vim for gtk3 too.
|
|
|
|
nixpkgs.config.vim.gui = "gtk3";
|
|
|
|
|
2018-03-02 23:05:29 +00:00
|
|
|
fonts.fonts = [ pkgs.dejavu_fonts pkgs.cantarell-fonts ];
|
2014-02-06 23:37:17 +00:00
|
|
|
|
2018-07-23 00:11:56 +01:00
|
|
|
services.xserver.displayManager.extraSessionFilePackages = [ pkgs.gnome3.gnome-session ];
|
2014-02-06 23:37:17 +00:00
|
|
|
|
2018-07-31 10:01:38 +01:00
|
|
|
services.xserver.displayManager.sessionCommands = ''
|
|
|
|
if test "$XDG_CURRENT_DESKTOP" = "GNOME"; then
|
|
|
|
${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}
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
2018-07-31 13:55:57 +01:00
|
|
|
environment.variables.GNOME_SESSION_DEBUG = optionalString cfg.debug "1";
|
2018-07-31 10:01:38 +01:00
|
|
|
|
2018-07-23 00:11:56 +01:00
|
|
|
# Override default mimeapps
|
|
|
|
environment.variables.XDG_DATA_DIRS = [ "${mimeAppsList}/share" ];
|
2014-02-06 23:37:17 +00:00
|
|
|
|
2018-07-23 00:11:56 +01:00
|
|
|
# Override GSettings schemas
|
|
|
|
environment.variables.NIX_GSETTINGS_OVERRIDES_DIR = "${nixos-gsettings-desktop-schemas}/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas";
|
2014-02-06 23:37:17 +00:00
|
|
|
|
2018-07-23 00:11:56 +01:00
|
|
|
# Let nautilus find extensions
|
|
|
|
# TODO: Create nautilus-with-extensions package
|
|
|
|
environment.variables.NAUTILUS_EXTENSION_DIR = "${config.system.path}/lib/nautilus/extensions-3.0";
|
2016-04-25 22:37:18 +01:00
|
|
|
|
2017-09-24 12:15:50 +01:00
|
|
|
environment.variables.GIO_EXTRA_MODULES = [ "${lib.getLib pkgs.gnome3.dconf}/lib/gio/modules"
|
2018-02-25 02:23:58 +00:00
|
|
|
"${pkgs.gnome3.glib-networking.out}/lib/gio/modules"
|
2017-09-24 12:15:50 +01:00
|
|
|
"${pkgs.gnome3.gvfs}/lib/gio/modules" ];
|
2018-07-31 10:01:38 +01:00
|
|
|
environment.systemPackages = pkgs.gnome3.corePackages ++ cfg.sessionPath
|
2018-07-22 22:32:12 +01:00
|
|
|
++ (removePackagesByName pkgs.gnome3.optionalPackages config.environment.gnome3.excludePackages) ++ [
|
|
|
|
pkgs.xdg-user-dirs # Update user dirs as described in http://freedesktop.org/wiki/Software/xdg-user-dirs/
|
|
|
|
];
|
2014-04-14 23:15:20 +01:00
|
|
|
|
2015-04-10 16:02:57 +01:00
|
|
|
# Use the correct gnome3 packageSet
|
|
|
|
networking.networkmanager.basePackages =
|
|
|
|
{ inherit (pkgs) networkmanager modemmanager wpa_supplicant;
|
2018-02-25 02:23:58 +00:00
|
|
|
inherit (pkgs.gnome3) networkmanager-openvpn networkmanager-vpnc
|
|
|
|
networkmanager-openconnect networkmanager-fortisslvpn
|
2018-03-23 21:17:32 +00:00
|
|
|
networkmanager-iodine networkmanager-l2tp; };
|
2015-04-10 16:02:57 +01:00
|
|
|
|
2014-04-14 23:15:20 +01:00
|
|
|
# Needed for themes and backgrounds
|
|
|
|
environment.pathsToLink = [ "/share" ];
|
|
|
|
|
2014-02-06 23:37:17 +00:00
|
|
|
};
|
|
|
|
|
2014-02-16 20:37:18 +00:00
|
|
|
|
2014-02-06 23:37:17 +00:00
|
|
|
}
|