GNOME: Difference between revisions

Jasi (talk | contribs)
m GNOME desktop: fix typo
m Qt integration for GNOME: missing semicolon
 
(13 intermediate revisions by 5 users not shown)
Line 6: Line 6:


=== GNOME desktop ===
=== GNOME desktop ===
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 module options must be set:


{{file|3={ config, pkgs, ... }:
{{file|3={ config, pkgs, ... }:


{
{
  # Pre 25.11
  services.xserver.enable = true;
  services.xserver.displayManager.gdm.enable = true;
  services.xserver.desktopManager.gnome.enable = true;
  # As of 25.11
   services.displayManager.gdm.enable = true;
   services.displayManager.gdm.enable = true;
   services.desktopManager.gnome.enable = true;
   services.desktopManager.gnome.enable = true;
Line 28: Line 21:
   environment.gnome.excludePackages = with pkgs; [ gnome-tour gnome-user-docs ];
   environment.gnome.excludePackages = with pkgs; [ gnome-tour gnome-user-docs ];


}|name=/etc/nixos/configuration.nix|lang=nix}}
}|name=/etc/nixos/configuration.nix|lang=nix}}Mixing GNOME with other desktops (such as alternative login managers other than GDM) is not supported, make sure to disable other desktop modules before rebuilding if you encounter issues with conflicting desktops.  
 
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 ===
Line 84: Line 75:
     };
     };
   };
   };
}|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">
}|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=console>
$ dconf reset -f /
$ dconf reset -f /
</syntaxhighlight>
</syntaxhighlight>
Line 128: Line 120:
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.  
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 ===
=== Qt integration for GNOME ===
Using the following example configuration, Qt applications will have a look similar to the adwaita style used by GNOME using a dark theme.
As of NixOS 26.05, the <code>qt.platformTheme = "gnome";</code> option results in broken Qt app theming when GNOME is set to dark mode. If you only want "Adwaita-looking" Qt apps so they don't look too out of place, you can install the packages for QAdwaitaDecorations and QGnomePlatform, which provide quite decent GNOME theming for Qt apps.<syntaxhighlight lang="nixos"># Install QAdwaitaDecorations and QGnomePlatform
{ pkgs, ... }:
 
{
  environment.systemPackages = [
    # Themes the app titlebars
    pkgs.qadwaitadecorations
    pkgs.qadwaitadecorations-qt6
    # Themes the apps
    pkgs.qgnomeplatform
    pkgs.qgnomeplatform-qt6
  ];
}</syntaxhighlight>Alternatively, the older <code>qt.platformTheme</code> docs have been included below.
In the following example configuration, Qt applications will have a look similar to the adwaita style used by GNOME using a dark theme.
{{File|3={
{{File|3={
   qt = {
   qt = {
Line 152: Line 157:
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.}}
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 ===
=== Experimental features ===
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:
GNOME has a number of experimental options for features not fully completed and thus hidden from the user. As of GNOME 50, these are the experimental features you may want to try out:
{{File|3={
{{File|3={
   programs.dconf.profiles.user.databases = [
   programs.dconf.profiles.user.databases = [
Line 160: Line 165:
         "org/gnome/mutter" = {
         "org/gnome/mutter" = {
           experimental-features = [
           experimental-features = [
             "scale-monitor-framebuffer" # Enables fractional scaling (125% 150% 175%)
             "autoclose-xwayland" # automatically terminates Xwayland if all relevant X11 clients are gone
             "variable-refresh-rate" # Enables Variable Refresh Rate (VRR) on compatible displays
             # "kms-modifiers" # allocate scanout buffers using "explicit modifiers" if your graphics driver supports it. Uncomment if you want to test NVIDIA optimizations
            "xwayland-native-scaling" # Scales Xwayland applications to look crisp on HiDPI screens
           ];
           ];
         };
         };
Line 171: Line 175:


=== Discover dconf settings ===
=== Discover dconf settings ===
If you wish to discover the corresponding dconf entry for a given setting in a program, you can run `dconf watch /` inside of a terminal and change the setting graphically. For example, when changing toggling the Quick-Settings option "Dark Style" from "on" to "off" and back to "on," this will be the output:<syntaxhighlight lang="shell-session">
If you wish to discover the corresponding dconf entry for a given setting in a program, you can run <code>dconf watch /</code> inside of a terminal and change the setting graphically. For example, when changing toggling the Quick-Settings option "Dark Style" from "on" to "off" and back to "on," this will be the output:<syntaxhighlight lang="shell-session">
$ dconf watch /
$ dconf watch /
/org/gnome/desktop/interface/color-scheme
/org/gnome/desktop/interface/color-scheme
Line 204: Line 208:


=== Enable system tray icons ===
=== 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 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 panel. You can install this extension with the following in NixOS:
{{File|3={
{{File|3={
   environment.systemPackages = [ pkgs.gnomeExtensions.appindicator ];
   environment.systemPackages = [ pkgs.gnomeExtensions.appindicator ];
  services.udev.packages = [ pkgs.gnome-settings-daemon ];
}|name=/etc/nixos/configuration.nix|lang=nix}}You can also install the extension outside of Nix and it will function the same.
}|name=/etc/nixos/configuration.nix|lang=nix}}


=== Profiling (with sysprof) ===
=== Profiling (with sysprof) ===
Line 215: Line 218:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
  services.sysprof.enable = true;
services.sysprof.enable = true;
</syntaxhighlight>
</syntaxhighlight>


Line 221: Line 224:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
  hardware.sensor.iio.enable = true;
hardware.sensor.iio.enable = true;
</syntaxhighlight>
</syntaxhighlight>


Line 242: Line 245:


{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
  environment.gnome.excludePackages = with pkgs; [
environment.gnome.excludePackages = with pkgs; [
    totem
  showtime
  ];
];
</nowiki>}}
</nowiki>|name=/etc/nixos/configuration.nix|lang=nix}}


== Troubleshooting ==
== Troubleshooting ==


=== Missing cursor/cursor is a white box ===
=== 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">
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 alongside any number of silent incompatabilities: reset all dconf settings.
<syntaxhighlight lang=console>
$ dconf reset -f /
$ dconf reset -f /
</syntaxhighlight>
</syntaxhighlight>
Line 272: Line 276:
=== 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:
For automatic login, include this in your NixOS configuration adjusting the "<your username>" part with your username:


{{File|3={
{{File|3={
   services.xserver.displayManager.autoLogin.enable = true;
   services.displayManager.autoLogin.enable = true;
   services.xserver.displayManager.autoLogin.user = "account";
   services.displayManager.autoLogin.user = "<your username>";
 
  systemd.services."getty@tty1".enable = false;
  systemd.services."autovt@tty1".enable = false;
}|name=/etc/nixos/configuration.nix|lang=nix}}
}|name=/etc/nixos/configuration.nix|lang=nix}}