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
|
2019-08-25 23:52:38 +01:00
|
|
|
|
2014-02-06 23:37:17 +00:00
|
|
|
cfg = config.services.xserver.desktopManager.gnome3;
|
2019-08-25 23:52:38 +01:00
|
|
|
serviceCfg = config.services.gnome3;
|
2014-04-10 23:28:15 +01:00
|
|
|
|
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
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2019-08-14 21:54:52 +01:00
|
|
|
nixos-gsettings-desktop-schemas = let
|
|
|
|
defaultPackages = with pkgs; [ gsettings-desktop-schemas gnome3.gnome-shell ];
|
|
|
|
in
|
|
|
|
pkgs.runCommand "nixos-gsettings-desktop-schemas" { preferLocalBuild = true; }
|
2016-09-27 14:26:37 +01:00
|
|
|
''
|
2015-10-08 13:53:37 +01:00
|
|
|
mkdir -p $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas
|
|
|
|
|
2019-08-14 21:54:52 +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")
|
|
|
|
(defaultPackages ++ cfg.extraGSettingsOverridePackages)}
|
2015-10-08 13:53:37 +01:00
|
|
|
|
2019-10-04 03:27:04 +01:00
|
|
|
cp -f ${pkgs.gnome3.gnome-shell}/share/gsettings-schemas/*/glib-2.0/schemas/*.gschema.override $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas
|
|
|
|
|
2019-10-16 01:56:09 +01:00
|
|
|
${optionalString flashbackEnabled ''
|
|
|
|
cp -f ${pkgs.gnome3.gnome-flashback}/share/gsettings-schemas/*/glib-2.0/schemas/*.gschema.override $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas
|
|
|
|
''}
|
|
|
|
|
2015-10-08 13:53:37 +01:00
|
|
|
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]
|
2019-08-24 20:15:05 +01:00
|
|
|
picture-uri='file://${pkgs.nixos-artwork.wallpapers.simple-dark-gray}/share/artwork/gnome/nix-wallpaper-simple-dark-gray.png'
|
2015-07-30 17:05:14 +01:00
|
|
|
|
2015-07-29 15:27:09 +01:00
|
|
|
[org.gnome.desktop.screensaver]
|
2019-08-24 20:15:05 +01:00
|
|
|
picture-uri='file://${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
|
|
|
|
2019-08-14 21:54:52 +01:00
|
|
|
[org.gnome.shell]
|
2019-08-26 11:42:34 +01:00
|
|
|
favorite-apps=[ 'org.gnome.Epiphany.desktop', 'org.gnome.Geary.desktop', 'org.gnome.Music.desktop', 'org.gnome.Photos.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Software.desktop' ]
|
2019-08-14 21:54:52 +01:00
|
|
|
|
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
|
|
|
'';
|
|
|
|
|
2019-01-09 08:52:58 +00:00
|
|
|
flashbackEnabled = cfg.flashback.enableMetacity || length cfg.flashback.customSessions > 0;
|
|
|
|
|
2019-08-25 23:52:38 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
2014-02-06 23:37:17 +00:00
|
|
|
|
|
|
|
options = {
|
|
|
|
|
2019-08-25 23:52:38 +01:00
|
|
|
services.gnome3 = {
|
|
|
|
core-os-services.enable = mkEnableOption "essential services for GNOME3";
|
|
|
|
core-shell.enable = mkEnableOption "GNOME Shell services";
|
|
|
|
core-utilities.enable = mkEnableOption "GNOME core utilities";
|
|
|
|
games.enable = mkEnableOption "GNOME games";
|
|
|
|
};
|
|
|
|
|
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 ]";
|
2018-08-01 18:02:50 +01:00
|
|
|
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).
|
|
|
|
'';
|
2018-07-31 10:01:38 +01:00
|
|
|
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";
|
2019-01-09 08:52:58 +00:00
|
|
|
|
|
|
|
flashback = {
|
2019-04-20 02:41:48 +01:00
|
|
|
enableMetacity = mkEnableOption "the standard GNOME Flashback session with Metacity";
|
2019-01-09 08:52:58 +00:00
|
|
|
|
|
|
|
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.";
|
|
|
|
};
|
|
|
|
};
|
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
|
|
|
};
|
|
|
|
|
2019-08-25 23:52:38 +01:00
|
|
|
config = mkMerge [
|
2019-08-26 10:36:11 +01:00
|
|
|
(mkIf (cfg.enable || flashbackEnabled) {
|
2019-08-25 23:52:38 +01:00
|
|
|
services.gnome3.core-os-services.enable = true;
|
|
|
|
services.gnome3.core-shell.enable = true;
|
|
|
|
services.gnome3.core-utilities.enable = mkDefault true;
|
|
|
|
|
2019-08-26 10:36:11 +01:00
|
|
|
services.xserver.displayManager.extraSessionFilePackages = [ pkgs.gnome3.gnome-session ];
|
2014-02-06 23:37:17 +00:00
|
|
|
|
2019-08-25 23:52:38 +01: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}
|
|
|
|
'';
|
|
|
|
|
|
|
|
environment.systemPackages = cfg.sessionPath;
|
|
|
|
|
2019-09-28 00:48:44 +01:00
|
|
|
environment.sessionVariables.GNOME_SESSION_DEBUG = mkIf cfg.debug "1";
|
2019-08-25 23:52:38 +01:00
|
|
|
|
|
|
|
# Override GSettings schemas
|
2019-09-28 00:48:44 +01:00
|
|
|
environment.sessionVariables.NIX_GSETTINGS_OVERRIDES_DIR = "${nixos-gsettings-desktop-schemas}/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas";
|
2019-08-25 23:52:38 +01:00
|
|
|
|
|
|
|
# If gnome3 is installed, build vim for gtk3 too.
|
|
|
|
nixpkgs.config.vim.gui = "gtk3";
|
|
|
|
})
|
|
|
|
|
2019-08-26 10:36:11 +01:00
|
|
|
(mkIf flashbackEnabled {
|
|
|
|
services.xserver.displayManager.extraSessionFilePackages = 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);
|
|
|
|
|
2019-10-15 23:18:20 +01:00
|
|
|
systemd.packages = with pkgs.gnome3; [
|
|
|
|
gnome-flashback
|
|
|
|
];
|
|
|
|
|
2019-08-26 10:36:11 +01:00
|
|
|
security.pam.services.gnome-screensaver = {
|
|
|
|
enableGnomeKeyring = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
services.dbus.packages = [
|
|
|
|
pkgs.gnome3.gnome-screensaver
|
|
|
|
];
|
|
|
|
})
|
|
|
|
|
2019-08-25 23:52:38 +01:00
|
|
|
(mkIf serviceCfg.core-os-services.enable {
|
|
|
|
hardware.bluetooth.enable = mkDefault true;
|
|
|
|
hardware.pulseaudio.enable = mkDefault true;
|
|
|
|
programs.dconf.enable = true;
|
|
|
|
security.polkit.enable = true;
|
|
|
|
services.accounts-daemon.enable = true;
|
|
|
|
services.dleyna-renderer.enable = mkDefault true;
|
|
|
|
services.dleyna-server.enable = mkDefault true;
|
|
|
|
services.gnome3.at-spi2-core.enable = true;
|
|
|
|
services.gnome3.evolution-data-server.enable = true;
|
|
|
|
services.gnome3.gnome-keyring.enable = true;
|
|
|
|
services.gnome3.gnome-online-accounts.enable = mkDefault true;
|
|
|
|
services.gnome3.gnome-online-miners.enable = true;
|
|
|
|
services.gnome3.tracker-miners.enable = mkDefault true;
|
|
|
|
services.gnome3.tracker.enable = mkDefault true;
|
|
|
|
services.hardware.bolt.enable = mkDefault true;
|
|
|
|
services.packagekit.enable = mkDefault true;
|
|
|
|
services.udisks2.enable = true;
|
|
|
|
services.upower.enable = config.powerManagement.enable;
|
|
|
|
services.xserver.libinput.enable = mkDefault true; # for controlling touchpad settings via gnome control center
|
|
|
|
|
|
|
|
xdg.portal.enable = true;
|
|
|
|
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
|
|
|
|
|
|
|
|
networking.networkmanager.enable = mkDefault true;
|
|
|
|
|
|
|
|
services.xserver.updateDbusEnvironment = true;
|
|
|
|
|
|
|
|
# Needed for themes and backgrounds
|
|
|
|
environment.pathsToLink = [
|
|
|
|
"/share" # TODO: https://github.com/NixOS/nixpkgs/issues/47173
|
|
|
|
];
|
|
|
|
})
|
|
|
|
|
|
|
|
(mkIf serviceCfg.core-shell.enable {
|
|
|
|
services.colord.enable = mkDefault true;
|
2019-09-06 04:10:09 +01:00
|
|
|
services.gnome3.chrome-gnome-shell.enable = mkDefault true;
|
2019-08-25 23:52:38 +01:00
|
|
|
services.gnome3.glib-networking.enable = true;
|
2019-09-19 20:12:18 +01:00
|
|
|
services.gnome3.gnome-initial-setup.enable = mkDefault true;
|
2019-08-25 23:52:38 +01:00
|
|
|
services.gnome3.gnome-remote-desktop.enable = mkDefault true;
|
|
|
|
services.gnome3.gnome-settings-daemon.enable = true;
|
|
|
|
services.gnome3.gnome-user-share.enable = mkDefault true;
|
|
|
|
services.gnome3.rygel.enable = mkDefault true;
|
|
|
|
services.gvfs.enable = true;
|
2019-09-06 14:45:49 +01:00
|
|
|
services.system-config-printer.enable = (mkIf config.services.printing.enable (mkDefault true));
|
2019-08-25 23:52:38 +01:00
|
|
|
services.telepathy.enable = mkDefault true;
|
2019-09-16 06:19:00 +01:00
|
|
|
|
2019-10-03 02:39:24 +01:00
|
|
|
systemd.packages = with pkgs.gnome3; [ vino gnome-session ];
|
2019-08-25 23:52:38 +01:00
|
|
|
|
2019-08-26 11:50:20 +01:00
|
|
|
services.avahi.enable = mkDefault true;
|
|
|
|
|
2019-09-10 00:28:59 +01:00
|
|
|
xdg.portal.extraPortals = [ pkgs.gnome3.gnome-shell ];
|
|
|
|
|
2019-08-25 23:52:38 +01:00
|
|
|
services.geoclue2.enable = mkDefault true;
|
|
|
|
services.geoclue2.enableDemoAgent = false; # GNOME has its own geoclue agent
|
|
|
|
|
2019-09-09 00:38:31 +01:00
|
|
|
services.geoclue2.appConfig.gnome-datetime-panel = {
|
2019-08-25 23:52:38 +01:00
|
|
|
isAllowed = true;
|
|
|
|
isSystem = true;
|
|
|
|
};
|
2019-09-09 00:38:31 +01:00
|
|
|
services.geoclue2.appConfig.gnome-color-panel = {
|
2019-08-25 23:52:38 +01:00
|
|
|
isAllowed = true;
|
|
|
|
isSystem = true;
|
|
|
|
};
|
|
|
|
services.geoclue2.appConfig."org.gnome.Shell" = {
|
|
|
|
isAllowed = true;
|
|
|
|
isSystem = true;
|
|
|
|
};
|
2014-02-06 23:37:17 +00:00
|
|
|
|
2019-08-25 23:52:38 +01:00
|
|
|
fonts.fonts = with pkgs; [
|
|
|
|
cantarell-fonts
|
|
|
|
dejavu_fonts
|
|
|
|
source-code-pro # Default monospace font in 3.32
|
|
|
|
source-sans-pro
|
|
|
|
];
|
|
|
|
|
2019-08-26 11:50:20 +01:00
|
|
|
# Adapt from https://gitlab.gnome.org/GNOME/gnome-build-meta/blob/gnome-3-32/elements/core/meta-gnome-core-shell.bst
|
2019-08-25 23:52:38 +01:00
|
|
|
environment.systemPackages = with pkgs.gnome3; [
|
|
|
|
adwaita-icon-theme
|
|
|
|
gnome-backgrounds
|
|
|
|
gnome-bluetooth
|
2019-08-26 11:50:20 +01:00
|
|
|
gnome-color-manager
|
2019-08-25 23:52:38 +01:00
|
|
|
gnome-control-center
|
|
|
|
gnome-getting-started-docs
|
|
|
|
gnome-shell
|
|
|
|
gnome-shell-extensions
|
|
|
|
gnome-themes-extra
|
|
|
|
gnome-user-docs
|
2019-08-26 11:50:20 +01:00
|
|
|
pkgs.orca
|
2019-08-25 23:52:38 +01:00
|
|
|
pkgs.glib # for gsettings
|
|
|
|
pkgs.gnome-menus
|
|
|
|
pkgs.gtk3.out # for gtk-launch
|
|
|
|
pkgs.hicolor-icon-theme
|
|
|
|
pkgs.shared-mime-info # for update-mime-database
|
|
|
|
pkgs.xdg-user-dirs # Update user dirs as described in http://freedesktop.org/wiki/Software/xdg-user-dirs/
|
|
|
|
vino
|
|
|
|
];
|
|
|
|
})
|
|
|
|
|
2019-08-26 11:42:34 +01:00
|
|
|
# Adapt from https://gitlab.gnome.org/GNOME/gnome-build-meta/blob/gnome-3-32/elements/core/meta-gnome-core-utilities.bst
|
2019-08-25 23:52:38 +01:00
|
|
|
(mkIf serviceCfg.core-utilities.enable {
|
|
|
|
environment.systemPackages = (with pkgs.gnome3; removePackagesByName [
|
2019-08-26 11:42:34 +01:00
|
|
|
baobab
|
|
|
|
cheese
|
|
|
|
eog
|
|
|
|
epiphany
|
|
|
|
geary
|
|
|
|
gedit
|
|
|
|
gnome-calculator
|
|
|
|
gnome-calendar
|
|
|
|
gnome-characters
|
|
|
|
gnome-clocks
|
|
|
|
gnome-contacts
|
|
|
|
gnome-font-viewer
|
|
|
|
gnome-logs
|
|
|
|
gnome-maps
|
|
|
|
gnome-music
|
|
|
|
gnome-photos
|
|
|
|
gnome-screenshot
|
|
|
|
gnome-software
|
|
|
|
gnome-system-monitor
|
|
|
|
gnome-weather
|
|
|
|
nautilus
|
|
|
|
simple-scan
|
|
|
|
totem
|
|
|
|
yelp
|
|
|
|
# Unsure if sensible for NixOS
|
|
|
|
/* gnome-boxes */
|
2019-08-25 23:52:38 +01:00
|
|
|
] config.environment.gnome3.excludePackages);
|
|
|
|
|
|
|
|
# Enable default programs
|
|
|
|
programs.evince.enable = mkDefault true;
|
|
|
|
programs.file-roller.enable = mkDefault true;
|
|
|
|
programs.gnome-disks.enable = mkDefault true;
|
|
|
|
programs.gnome-terminal.enable = mkDefault true;
|
2019-08-26 11:42:34 +01:00
|
|
|
programs.seahorse.enable = mkDefault true;
|
2019-08-25 23:52:38 +01:00
|
|
|
services.gnome3.sushi.enable = mkDefault true;
|
|
|
|
|
|
|
|
# Let nautilus find extensions
|
|
|
|
# TODO: Create nautilus-with-extensions package
|
2019-09-28 00:48:44 +01:00
|
|
|
environment.sessionVariables.NAUTILUS_EXTENSION_DIR = "${config.system.path}/lib/nautilus/extensions-3.0";
|
2019-08-25 23:52:38 +01:00
|
|
|
|
|
|
|
# Override default mimeapps for nautilus
|
2019-09-28 00:48:44 +01:00
|
|
|
environment.sessionVariables.XDG_DATA_DIRS = [ "${mimeAppsList}/share" ];
|
2019-08-25 23:52:38 +01:00
|
|
|
|
|
|
|
environment.pathsToLink = [
|
|
|
|
"/share/nautilus-python/extensions"
|
|
|
|
];
|
|
|
|
})
|
|
|
|
|
|
|
|
(mkIf serviceCfg.games.enable {
|
|
|
|
environment.systemPackages = (with pkgs.gnome3; removePackagesByName [
|
|
|
|
aisleriot atomix five-or-more four-in-a-row gnome-chess gnome-klotski
|
|
|
|
gnome-mahjongg gnome-mines gnome-nibbles gnome-robots gnome-sudoku
|
|
|
|
gnome-taquin gnome-tetravex hitori iagno lightsoff quadrapassel
|
|
|
|
swell-foop tali
|
|
|
|
] config.environment.gnome3.excludePackages);
|
|
|
|
})
|
|
|
|
];
|
2014-02-16 20:37:18 +00:00
|
|
|
|
2014-02-06 23:37:17 +00:00
|
|
|
}
|