GNOME: Difference between revisions
m →Installation: Revise sub-headings to match style. |
m →GNOME desktop: fix typo |
||
(30 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
[[{{PAGENAME}}]] (/(ɡ)noʊm/) is a [[:Category:Desktop environment|desktop environment | [[{{PAGENAME}}]] (/(ɡ)noʊm/) is a [[:Category:Desktop environment|desktop environment]] that seeks to be "an independent computing platform for everyone."<ref>Official GNOME Project one-liner https://www.gnome.org/ </ref> | ||
This article is an extension of the documentation in the [https://nixos.org/manual/nixos/stable/#chap-gnome NixOS manual]. | This article is an extension of the documentation in the [https://nixos.org/manual/nixos/stable/#chap-gnome NixOS manual]. | ||
Line 8: | Line 8: | ||
To use the GNOME desktop environment on NixOS, the following configuration options must be set: | To use the GNOME desktop environment on NixOS, the following configuration options must be set: | ||
{{file| | {{file|3={ config, pkgs, ... }: | ||
{ | { | ||
# Pre 25.11 | # Pre 25.11 | ||
services.xserver.enable = true; | services.xserver.enable = true; | ||
Line 18: | Line 20: | ||
services.displayManager.gdm.enable = true; | services.displayManager.gdm.enable = true; | ||
services.desktopManager.gnome.enable = true; | services.desktopManager.gnome.enable = true; | ||
Despite the options in NixOS versions before 25.11 being under the <code>xserver</code> | # To disable installing GNOME's suite of applications | ||
# and only be left with GNOME shell. | |||
services.gnome.core-apps.enable = false; | |||
services.gnome.core-developer-tools.enable = false; | |||
services.gnome.games.enable = false; | |||
environment.gnome.excludePackages = with pkgs; [ gnome-tour gnome-user-docs ]; | |||
}|name=/etc/nixos/configuration.nix|lang=nix}} | |||
Despite the options in NixOS versions before 25.11 being under the <code>xserver</code> module, GNOME uses [[Wayland]] by default. NixOS 25.11 and later removes support for the [[Xorg]] session entirely (though Xwayland is still included and supported for compatibility). | |||
=== GNOME extensions === | === GNOME extensions === | ||
GNOME offers support for changing/overhauling the user interface (GNOME Shell) through the use of ''[https://extensions.gnome.org/about/ Extensions].'' Extensions are bundles of third-party [https://gjs.guide/extensions/ GJS] modules that are loaded while GNOME is running to augment the user experience. A repository of GNOME extensions can be found on GNOME's official [https://extensions.gnome.org/ webpage] and can be installed imperatively if needed by unpacking the extension in <code>~/.local/share/gnome-shell/extensions</code> directory. Extensions can only be activated if it supports the GNOME release that it's installed alongside with. | GNOME offers support for changing/overhauling the user interface (GNOME Shell) through the use of ''[https://extensions.gnome.org/about/ Extensions].'' Extensions are bundles of third-party [https://gjs.guide/extensions/ GJS] modules that are loaded while GNOME is running to augment the user experience. A repository of GNOME extensions can be found on GNOME's official [https://extensions.gnome.org/ webpage] and can be installed imperatively if needed by unpacking the extension in <code>~/.local/share/gnome-shell/extensions</code> directory. Extensions can only be activated if it supports the GNOME release that it's installed alongside with. | ||
In addition, NixOS automatically packages all officially available GNOME extensions under the <code>pkgs.gnomeExtensions</code> attribute. Extensions which require additional dependencies are then manually packaged if needed. Installed extensions can be enabled graphically through the built-in "Extensions" application or through the <code>gnome-extensions</code> command line interface. | |||
{{file|3={ | {{file|3={ | ||
Line 43: | Line 52: | ||
For example, the setting which controls the accent color of GNOME shell is located in the ''schema'' labeled <code>/org/gnome/desktop/interface/</code> which contains the ''key'' <code>accent-color</code> which accepts a GVariant ''value'' of type <code>enum</code> (one of <code>'blue'</code>, <code>'teal'</code>, <code>'green'</code>, etc) | For example, the setting which controls the accent color of GNOME shell is located in the ''schema'' labeled <code>/org/gnome/desktop/interface/</code> which contains the ''key'' <code>accent-color</code> which accepts a GVariant ''value'' of type <code>enum</code> (one of <code>'blue'</code>, <code>'teal'</code>, <code>'green'</code>, etc) | ||
NixOS and Home Manager both provide an interface for declarative configuration of dconf settings exposed in <code>programs.dconf</code> and <code>dconf</code> modules respectively | NixOS and Home Manager both provide an interface for declarative configuration of dconf settings exposed in <code>programs.dconf</code> and <code>dconf</code> modules respectively. | ||
Going back to the previous example, to set the accent color of GNOME in a declarative manner in NixOS as well as mapping the keyboard's "caps lock" key to "ctrl" you would write: | Going back to the previous example, to set the accent color of GNOME in a declarative manner in NixOS as well as mapping the keyboard's "caps lock" key to "ctrl" you would write: | ||
Line 61: | Line 70: | ||
} | } | ||
]; | ]; | ||
}|name=/etc/nixos/configuration.nix|lang= | }|name=/etc/nixos/configuration.nix|lang=nix}} | ||
And the equivalent snippet in Home Manager: | And the equivalent snippet in Home Manager: | ||
Line 75: | Line 84: | ||
}; | }; | ||
}; | }; | ||
}|name=~/.config/home-manager/home.nix|lang=nix}} | }|name=~/.config/home-manager/home.nix|lang=nix}}Thus the settings attribute accepts an attribute set whose keys are schemas with each schema's value being a nested attribute set of the schema's keys with their appropriate GVariant value.{{Note|Schemas in Nix are written without leading and trailing slashes. In addition, since dconf have more data types than the Nix language (for example, tuples), in some cases you'll need to convert Nix value to a GVariant value. You can achieve that by using the functions defined under <code>lib.gvariant</code>, they're documented [https://nixos.org/manual/nixpkgs/stable/#sec-functions-library-gvariant here].}}If you wish to revert all dconf settings back to their default state (reset GNOME essentially) then use the following command which resets all schemas directories available on your system, note that this will affect all programs that use dconf, including GNOME apps and extensions.<syntaxhighlight lang="bash"> | ||
$ dconf reset -f / | |||
{{Note|Schemas in Nix are written without leading and trailing slashes. In addition, since dconf have more data types than the Nix language (for example, tuples), in some cases you'll need to convert Nix value to a GVariant value. You can achieve that by using | </syntaxhighlight> | ||
==== Extensions ==== | ==== Extensions ==== | ||
Line 89: | Line 98: | ||
settings = { | settings = { | ||
"org/gnome/shell" = { | "org/gnome/shell" = { | ||
disable-user-extensions = | # disable-user-extensions = true; # Optionally disable user extensions entirely | ||
enabled-extensions = [ | enabled-extensions = [ | ||
# Put UUIDs of extensions that you want to enable here. | # Put UUIDs of extensions that you want to enable here. | ||
Line 113: | Line 122: | ||
== Tips and tricks == | == Tips and tricks == | ||
=== GNOME power user apps === | |||
Both GNOME Tweaks (accessible as <code>gnome-tweaks</code>) and [https://gitlab.gnome.org/TheEvilSkeleton/Refine Refine] (accessible as <code>refine</code>) allow you to change certain GNOME settings that are hidden by default (such as interface font, window decoration buttons like maximize/minimize, icon themes and GTK themes, etc). | |||
The GNOME shell extension [https://extensions.gnome.org/extension/3843/just-perfection/ Just Perfection] also allows for customizing nearly all parts of the GNOME shell interface. | |||
=== GNOME Qt integration === | |||
Using the following example configuration, Qt applications will have a look similar to the adwaita style used by GNOME using a dark theme. | |||
{{File|3={ | |||
qt = { | |||
enable = true; | |||
platformTheme = "gnome"; | |||
style = "adwaita-dark"; | |||
}; | |||
}|name=/etc/nixos/configuration.nix|lang=nix}} | |||
For other themes, you may need the packages <code>libsForQt5.qt5ct</code> and <code>libsForQt5.qtstyleplugin-kvantum</code> and a symlink from <code>~/.config/Kvantum/</code> to your theme package. Here is an example using Arc-Dark and [[Home Manager]]. In the Home Manager configuration: | |||
{{File|3={ | |||
qt = { | |||
enable = true; | |||
platformTheme = "qtct"; | |||
style = "kvantum"; | |||
}; | |||
xdg.configFile = { | |||
"Kvantum/ArcDark".source = "${pkgs.arc-kde-theme}/share/Kvantum/ArcDark"; | |||
"Kvantum/kvantum.kvconfig".text = "[General]\ntheme=ArcDark"; | |||
}; | |||
}|name=~/.config/home-manager/home.nix|lang=nix}} | |||
For more details, see [https://discourse.nixos.org/t/guide-to-installing-qt-theme/35523/2 this] forum post.{{Note|Qt integration with the adwaita style isn't perfect and your mileage may vary.}} | |||
=== Experimental settings === | |||
GNOME has a number of experimental settings for features not fully completed and thus hidden from the user. As of GNOME 48, these are the experimental features you may want to use: | |||
{{File|3={ | |||
programs.dconf.profiles.user.databases = [ | |||
{ | |||
settings = { | |||
"org/gnome/mutter" = { | |||
experimental-features = [ | |||
"scale-monitor-framebuffer" # Enables fractional scaling (125% 150% 175%) | |||
"variable-refresh-rate" # Enables Variable Refresh Rate (VRR) on compatible displays | |||
"xwayland-native-scaling" # Scales Xwayland applications to look crisp on HiDPI screens | |||
]; | |||
}; | |||
}; | |||
} | |||
]; | |||
}|name=/etc/nixos/configuration.nix|lang=nix}} | |||
=== Discover dconf settings === | === Discover dconf settings === | ||
Line 147: | Line 203: | ||
</syntaxhighlight>Which tells you that the ''key'' <code>picture-options</code> located in ''schema'' <code>/org/gnome/desktop/background/</code> accepts a ''value'' of type enumeration (a single string value from a set of accepted values). | </syntaxhighlight>Which tells you that the ''key'' <code>picture-options</code> located in ''schema'' <code>/org/gnome/desktop/background/</code> accepts a ''value'' of type enumeration (a single string value from a set of accepted values). | ||
=== | === Enable system tray icons === | ||
GNOME does not currently support system tray icons. However, Ubuntu has created an [https://extensions.gnome.org/extension/615/appindicator-support/ extension] that implements this in the top bar. You can install this extension with the following in NixOS: | |||
GNOME | {{File|3={ | ||
environment.systemPackages = [ pkgs.gnomeExtensions.appindicator ]; | |||
{ | |||
{ | |||
environment.systemPackages = [ pkgs.gnomeExtensions.appindicator ]; | |||
services.udev.packages = [ pkgs.gnome-settings-daemon ]; | services.udev.packages = [ pkgs.gnome-settings-daemon ]; | ||
} | }|name=/etc/nixos/configuration.nix|lang=nix}} | ||
=== Profiling (with sysprof) === | === Profiling (with sysprof) === | ||
Line 212: | Line 235: | ||
}; | }; | ||
} | } | ||
</nowiki>}} | |||
=== Excluding GNOME Applications === | |||
To exclude certain applications that are installed by default with GNOME, set the {{nixos:option|environment.gnome.excludePackages}} module option (Optional Packages: [https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/services/desktop-managers/gnome.nix#L449-L471 gnome.nix]): | |||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | |||
environment.gnome.excludePackages = with pkgs; [ | |||
totem | |||
]; | |||
</nowiki>}} | </nowiki>}} | ||
== Troubleshooting == | == Troubleshooting == | ||
=== Missing cursor/cursor is a white box === | |||
This occurs when installing GNOME from an existing NixOS installation that used a different desktop environment that modified dconf (most likely switching from KDE to GNOME). To easily fix this: reset all dconf settings.<syntaxhighlight lang="bash"> | |||
$ dconf reset -f / | |||
</syntaxhighlight> | |||
=== Running GConf-based applications === | === Running GConf-based applications === | ||
Line 234: | Line 272: | ||
=== Automatic login === | === Automatic login === | ||
As a potential workaround<ref>https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229</ref> for automatic login, include this in your NixOS configuration: | |||
: | |||
{{File|3={ | |||
services.xserver.displayManager.autoLogin.enable = true; | |||
services.xserver.displayManager.autoLogin.user = "account"; | |||
services.xserver.displayManager.autoLogin.enable = true; | |||
services.xserver.displayManager.autoLogin.user = "account"; | |||
systemd.services."getty@tty1".enable = false; | systemd.services."getty@tty1".enable = false; | ||
systemd.services."autovt@tty1".enable = false; | systemd.services."autovt@tty1".enable = false; | ||
} | }|name=/etc/nixos/configuration.nix|lang=nix}} | ||
= | |||
=== GDM does not show user === | |||
The GDM (GNOME Display Manager) will not display a user if their default shell is not listed in <code>/etc/shells</code>. If your shell, such as zsh, is not included in <code>/etc/shells</code>, you need to add it to the configuration.{{File|3={ | |||
environment.shells = with pkgs; [ zsh ]; | |||
}|name=/etc/nixos/configuration.nix|lang=nix}} | |||
: | |||
== References == | |||
[[Category:Desktop environment]] | [[Category:Desktop environment]] | ||
[[Category:Applications]] | [[Category:Applications]] | ||
[[Category:NixOS Manual]] | [[Category:NixOS Manual]] | ||
[[Category:GNOME]] | [[Category:GNOME]] |