nixpkgs/nixos/modules/services/x11/desktop-managers/gnome3.nix

235 lines
9.3 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
2014-02-06 23:37:17 +00:00
with lib;
2014-02-06 23:37:17 +00:00
let
cfg = config.services.xserver.desktopManager.gnome3;
# 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
'';
};
nixos-gsettings-desktop-schemas = pkgs.runCommand "nixos-gsettings-desktop-schemas" { preferLocalBuild = true; }
''
2015-10-08 13:53:37 +01:00
mkdir -p $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas
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
[org.gnome.desktop.background]
picture-uri='${pkgs.nixos-artwork.wallpapers.simple-dark-gray}/share/artwork/gnome/nix-wallpaper-simple-dark-gray.png'
[org.gnome.desktop.screensaver]
picture-uri='${pkgs.nixos-artwork.wallpapers.simple-dark-gray-bottom}/share/artwork/gnome/nix-wallpaper-simple-dark-gray_bottom.png'
2015-10-08 13:53:37 +01:00
${cfg.extraGSettingsOverrides}
EOF
2015-10-08 13:53:37 +01:00
${pkgs.glib.dev}/bin/glib-compile-schemas $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas/
'';
flashbackEnabled = cfg.flashback.enableMetacity || length cfg.flashback.customSessions > 0;
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.";
};
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-conditional autostart.
Note that this should be a last resort; patching the package is preferred (see GPaste).
'';
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";
flashback = {
enableMetacity = mkEnableOption "Enable the standard GNOME Flashback session with Metacity.";
customSessions = mkOption {
type = types.listOf (types.submodule {
options = {
wmName = mkOption {
type = types.str;
description = "The filename-compatible name of the window manager to use.";
example = "xmonad";
};
wmLabel = mkOption {
type = types.str;
description = "The pretty name of the window manager to use.";
example = "XMonad";
};
wmCommand = mkOption {
type = types.str;
description = "The executable of the window manager to use.";
example = "\${pkgs.haskellPackages.xmonad}/bin/xmonad";
};
};
});
default = [];
description = "Other GNOME Flashback sessions to enable.";
};
};
};
environment.gnome3.excludePackages = mkOption {
default = [];
example = literalExample "[ pkgs.gnome3.totem ]";
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;
services.accounts-daemon.enable = true;
2014-04-24 22:32:32 +01:00
services.geoclue2.enable = mkDefault true;
# GNOME should have its own geoclue agent
services.geoclue2.enableDemoAgent = false;
services.dleyna-renderer.enable = mkDefault true;
services.dleyna-server.enable = mkDefault true;
services.gnome3.at-spi2-core.enable = true;
2019-03-26 11:08:58 +00:00
services.gnome3.evince.enable = mkDefault true;
services.gnome3.evolution-data-server.enable = true;
2019-01-18 20:04:36 +00:00
services.gnome3.file-roller.enable = mkDefault true;
services.gnome3.glib-networking.enable = true;
2017-05-06 18:40:37 +01:00
services.gnome3.gnome-disks.enable = mkDefault true;
services.gnome3.gnome-documents.enable = mkDefault true;
2014-04-10 23:41:51 +01:00
services.gnome3.gnome-keyring.enable = true;
services.gnome3.gnome-online-accounts.enable = mkDefault true;
services.gnome3.gnome-remote-desktop.enable = mkDefault true;
2019-01-25 16:43:36 +00:00
services.gnome3.gnome-settings-daemon.enable = true;
services.gnome3.gnome-terminal-server.enable = mkDefault true;
services.gnome3.gnome-user-share.enable = mkDefault true;
services.gnome3.gvfs.enable = true;
2018-08-15 10:16:39 +01:00
services.gnome3.rygel.enable = mkDefault true;
services.gnome3.seahorse.enable = mkDefault true;
services.gnome3.sushi.enable = mkDefault true;
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;
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;
services.dbus.packages =
optional config.services.printing.enable pkgs.system-config-printer ++
optional flashbackEnabled pkgs.gnome3.gnome-screensaver;
services.colord.enable = mkDefault true;
services.packagekit.enable = mkDefault true;
2015-04-10 16:02:57 +01:00
hardware.bluetooth.enable = mkDefault true;
services.hardware.bolt.enable = mkDefault true;
services.xserver.libinput.enable = mkDefault true; # for controlling touchpad settings via gnome control center
systemd.packages = [ pkgs.gnome3.vino ];
services.flatpak.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
2014-02-06 23:37:17 +00:00
# If gnome3 is installed, build vim for gtk3 too.
nixpkgs.config.vim.gui = "gtk3";
fonts.fonts = [
pkgs.dejavu_fonts pkgs.cantarell-fonts
pkgs.source-sans-pro
pkgs.source-code-pro # Default monospace font in 3.32
];
2014-02-06 23:37:17 +00:00
services.xserver.displayManager.extraSessionFilePackages = [ pkgs.gnome3.gnome-session ]
++ map
(wm: pkgs.gnome3.gnome-flashback.mkSessionForWm {
inherit (wm) wmName wmLabel wmCommand;
}) (optional cfg.flashback.enableMetacity {
wmName = "metacity";
wmLabel = "Metacity";
wmCommand = "${pkgs.gnome3.metacity}/bin/metacity";
} ++ cfg.flashback.customSessions);
2014-02-06 23:37:17 +00:00
environment.extraInit = ''
${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}
'';
2018-07-31 13:55:57 +01:00
environment.variables.GNOME_SESSION_DEBUG = optionalString cfg.debug "1";
# Override default mimeapps
environment.variables.XDG_DATA_DIRS = [ "${mimeAppsList}/share" ];
2014-02-06 23:37:17 +00: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
# Let nautilus find extensions
# TODO: Create nautilus-with-extensions package
environment.variables.NAUTILUS_EXTENSION_DIR = "${config.system.path}/lib/nautilus/extensions-3.0";
services.xserver.updateDbusEnvironment = true;
environment.variables.GIO_EXTRA_MODULES = [ "${lib.getLib pkgs.gnome3.dconf}/lib/gio/modules"
"${pkgs.gnome3.gvfs}/lib/gio/modules" ];
environment.systemPackages = pkgs.gnome3.corePackages ++ cfg.sessionPath
++ (pkgs.gnome3.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/
];
2015-04-10 16:02:57 +01:00
# Use the correct gnome3 packageSet
networking.networkmanager.basePackages =
{ inherit (pkgs) networkmanager modemmanager wpa_supplicant;
inherit (pkgs.gnome3) networkmanager-openvpn networkmanager-vpnc
networkmanager-openconnect networkmanager-fortisslvpn
networkmanager-iodine networkmanager-l2tp; };
2015-04-10 16:02:57 +01:00
# Needed for themes and backgrounds
environment.pathsToLink = [
"/share"
"/share/nautilus-python/extensions"
];
security.pam.services.gnome-screensaver = mkIf flashbackEnabled {
enableGnomeKeyring = true;
};
2014-02-06 23:37:17 +00:00
};
2014-02-06 23:37:17 +00:00
}