1# GNOME Desktop {#chap-gnome} 2 3GNOME provides a simple, yet full-featured desktop environment with a focus on productivity. Its Mutter compositor supports both Wayland and X server, and the GNOME Shell user interface is fully customizable by extensions. 4 5## Enabling GNOME {#sec-gnome-enable} 6 7All of the core apps, optional apps, games, and core developer tools from GNOME are available. 8 9To enable the GNOME desktop use: 10 11```nix 12{ 13 services.desktopManager.gnome.enable = true; 14 services.displayManager.gdm.enable = true; 15} 16``` 17 18::: {.note} 19While it is not strictly necessary to use GDM as the display manager with GNOME, it is recommended, as some features such as screen lock [might not work](#sec-gnome-faq-can-i-use-lightdm-with-gnome) without it. 20::: 21 22The default applications used in NixOS are very minimal, inspired by the defaults used in [gnome-build-meta](https://gitlab.gnome.org/GNOME/gnome-build-meta/blob/48.0/elements/core/meta-gnome-core-apps.bst). 23 24### GNOME without the apps {#sec-gnome-without-the-apps} 25 26If you’d like to only use the GNOME desktop and not the apps, you can disable them with: 27 28```nix 29{ services.gnome.core-apps.enable = false; } 30``` 31 32and none of them will be installed. 33 34If you’d only like to omit a subset of the core utilities, you can use 35[](#opt-environment.gnome.excludePackages). 36Note that this mechanism can only exclude core utilities, games and core developer tools. 37 38### Disabling GNOME services {#sec-gnome-disabling-services} 39 40It is also possible to disable many of the [core services](https://github.com/NixOS/nixpkgs/blob/b8ec4fd2a4edc4e30d02ba7b1a2cc1358f3db1d5/nixos/modules/services/x11/desktop-managers/gnome.nix#L329-L348). For example, if you do not need indexing files, you can disable TinySPARQL with: 41 42```nix 43{ 44 services.gnome.localsearch.enable = false; 45 services.gnome.tinysparql.enable = false; 46} 47``` 48 49Note, however, that doing so is not supported and might break some applications. Notably, GNOME Music cannot work without TinySPARQL. 50 51### GNOME games {#sec-gnome-games} 52 53You can install all of the GNOME games with: 54 55```nix 56{ services.gnome.games.enable = true; } 57``` 58 59### GNOME core developer tools {#sec-gnome-core-developer-tools} 60 61You can install GNOME core developer tools with: 62 63```nix 64{ services.gnome.core-developer-tools.enable = true; } 65``` 66 67## Enabling GNOME Flashback {#sec-gnome-enable-flashback} 68 69GNOME Flashback provides a desktop environment based on the classic GNOME 2 architecture. You can enable the default GNOME Flashback session, which uses the Metacity window manager, with: 70 71```nix 72{ services.desktopManager.gnome.flashback.enableMetacity = true; } 73``` 74 75It is also possible to create custom sessions that replace Metacity with a different window manager using [](#opt-services.desktopManager.gnome.flashback.customSessions). 76 77The following example uses `xmonad` window manager: 78 79```nix 80{ 81 services.desktopManager.gnome.flashback.customSessions = [ 82 { 83 wmName = "xmonad"; 84 wmLabel = "XMonad"; 85 wmCommand = "${pkgs.haskellPackages.xmonad}/bin/xmonad"; 86 enableGnomePanel = false; 87 } 88 ]; 89} 90``` 91 92## Icons and GTK Themes {#sec-gnome-icons-and-gtk-themes} 93 94Icon themes and GTK themes don’t require any special option to install in NixOS. 95 96You can add them to [](#opt-environment.systemPackages) and switch to them with GNOME Tweaks. 97If you’d like to do this manually in dconf, change the values of the following keys: 98 99``` 100/org/gnome/desktop/interface/gtk-theme 101/org/gnome/desktop/interface/icon-theme 102``` 103 104in `dconf-editor` 105 106## Shell Extensions {#sec-gnome-shell-extensions} 107 108Most Shell extensions are packaged under the `gnomeExtensions` attribute. 109Some packages that include Shell extensions, like `gpaste`, don’t have their extension decoupled under this attribute. 110 111You can install them like any other package: 112 113```nix 114{ 115 environment.systemPackages = [ 116 pkgs.gnomeExtensions.dash-to-dock 117 pkgs.gnomeExtensions.gsconnect 118 pkgs.gnomeExtensions.mpris-indicator-button 119 ]; 120} 121``` 122 123Unfortunately, we lack a way for these to be managed in a completely declarative way. 124So you have to enable them manually with an Extensions application. 125It is possible to use a [GSettings override](#sec-gnome-gsettings-overrides) for this on `org.gnome.shell.enabled-extensions`, but that will only influence the default value. 126 127## GSettings Overrides {#sec-gnome-gsettings-overrides} 128 129Majority of software building on the GNOME platform use GLib’s [GSettings](https://developer.gnome.org/gio/unstable/GSettings.html) system to manage runtime configuration. For our purposes, the system consists of XML schemas describing the individual configuration options, stored in the package, and a settings backend, where the values of the settings are stored. On NixOS, like on most Linux distributions, dconf database is used as the backend. 130 131[GSettings vendor overrides](https://developer.gnome.org/gio/unstable/GSettings.html#id-1.4.19.2.9.25) can be used to adjust the default values for settings of the GNOME desktop and apps by replacing the default values specified in the XML schemas. Using overrides will allow you to pre-seed user settings before you even start the session. 132 133::: {.warning} 134Overrides really only change the default values for GSettings keys so if you or an application changes the setting value, the value set by the override will be ignored. Until [NixOS’s dconf module implements changing values](https://github.com/NixOS/nixpkgs/issues/54150), you will either need to keep that in mind and clear the setting from the backend using `dconf reset` command when that happens, or use the [module from home-manager](https://nix-community.github.io/home-manager/options.html#opt-dconf.settings). 135::: 136 137You can override the default GSettings values using the 138[](#opt-services.desktopManager.gnome.extraGSettingsOverrides) option. 139 140Take note that whatever packages you want to override GSettings for, you need to add them to 141[](#opt-services.desktopManager.gnome.extraGSettingsOverridePackages). 142 143You can use `dconf-editor` tool to explore which GSettings you can set. 144 145### Example {#sec-gnome-gsettings-overrides-example} 146 147```nix 148{ 149 services.desktopManager.gnome = { 150 extraGSettingsOverrides = '' 151 # Change default background 152 [org.gnome.desktop.background] 153 picture-uri='file://${pkgs.nixos-artwork.wallpapers.mosaic-blue.gnomeFilePath}' 154 155 # Favorite apps in gnome-shell 156 [org.gnome.shell] 157 favorite-apps=['org.gnome.Console.desktop', 'org.gnome.Nautilus.desktop'] 158 ''; 159 160 extraGSettingsOverridePackages = [ 161 pkgs.gsettings-desktop-schemas # for org.gnome.desktop 162 pkgs.gnome-shell # for org.gnome.shell 163 ]; 164 }; 165} 166``` 167 168## Frequently Asked Questions {#sec-gnome-faq} 169 170### Can I use LightDM with GNOME? {#sec-gnome-faq-can-i-use-lightdm-with-gnome} 171 172Yes you can, and any other display-manager in NixOS. 173 174However, it doesn’t work correctly for the Wayland session of GNOME Shell yet, and 175won’t be able to lock your screen. 176 177See [this issue.](https://github.com/NixOS/nixpkgs/issues/56342)