GNOME: Difference between revisions
reformat code |
Added examples of managing extensions; updated dynamic triple buffering overlay, added warning; added curly braces (as NixOS manual do) to configuration examples to indicate its type (attribute set). |
||
Line 1: | Line 1: | ||
[[{{PAGENAME}}]] (/(ɡ)noʊm/) is a [[desktop environment]] known for its focus on being simple, intuitive, and easy to use. It is made by The GNOME Project and is composed entirely of free and open-source software. Its Mutter compositor supports both [[Wayland]] and X server, and the GNOME Shell user interface is customizable by extensions. | [[{{PAGENAME}}]] (/(ɡ)noʊm/) is a [[desktop environment]] known for its focus on being simple, intuitive, and easy to use. It is made by The GNOME Project and is composed entirely of free and open-source software. Its Mutter compositor supports both [[Wayland]] and X server, and the GNOME Shell user interface is customizable by extensions. | ||
Line 5: | Line 4: | ||
[https://gnome.org/ {{PAGENAME}}] is available as a [[module]] and can be enabled with <code>services.xserver.desktopManager</code>. | [https://gnome.org/ {{PAGENAME}}] is available as a [[module]] and can be enabled with <code>services.xserver.desktopManager</code>. | ||
== Installation == | == Installation == | ||
To use GNOME, add this to your configuration.nix: | To use GNOME, add this to your <code>configuration.nix</code>: | ||
< | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
services.xserver.enable = true; | { | ||
services.xserver.displayManager.gdm.enable = true; | services.xserver.enable = true; | ||
services.xserver.desktopManager.gnome.enable = true; | services.xserver.displayManager.gdm.enable = true; | ||
</ | services.xserver.desktopManager.gnome.enable = true; | ||
} | |||
</nowiki>}} | |||
=== Excluding GNOME Applications === | === Excluding GNOME Applications === | ||
To exclude certain applications that are installed by default with GNOME edit | To exclude certain applications that are installed by default with GNOME edit <code>configuration.nix</code> as follows: | ||
< | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
environment.gnome.excludePackages = (with pkgs; [ | { | ||
environment.gnome.excludePackages = (with pkgs; [ | |||
# for packages that are pkgs.*** | |||
gnome-tour | |||
]) ++ (with pkgs.gnome; [ | gnome-connections | ||
]) ++ (with pkgs.gnome; [ | |||
# for packages that are pkgs.gnome.* | |||
epiphany # web browser | |||
geary # email reader | |||
]); | evince # document viewer | ||
</ | ]); | ||
} | |||
</nowiki>}} | |||
== Configuration == | == Configuration == | ||
Line 39: | Line 43: | ||
Extensions can be installed with Nix, however they aren't enabled by default. To enable them the "Extensions" program can be used. | Extensions can be installed with Nix, however they aren't enabled by default. To enable them the "Extensions" program can be used. | ||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | |||
{ | |||
environment.systemPackages = with pkgs.gnomeExtensions; [ | |||
blur-my-shell | |||
pop-shell | |||
# ... | |||
]; | |||
} | |||
</nowiki>}} | |||
Extension can be enabled and configured in your system configuration. Look at the following example. | |||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | |||
{ | |||
programs.dconf = { | |||
enable = true; | |||
profiles.user.databases = [ | |||
{ | |||
settings = { | |||
"org/gnome/shell" = { | |||
disable-user-extensions = false; # enables user extensions (disabled by default) | |||
enabled-extensions = [ | |||
# Put UUIDs of extensions that you want to enable here. | |||
# If the extension you want to enable is packaged in nixpkgs, | |||
# you can easily get its UUID by accessing its extensionUuid | |||
# field (look at the following example). | |||
pkgs.gnomeExtensions.blur-my-shell.extensionUuid | |||
# Alternatively, you can manually pass UUID as a string. | |||
"blur-my-shell@aunetx" | |||
# ... | |||
]; | |||
}; | |||
# Configure individual extensions | |||
"org/gnome/shell/extensions/blur-my-shell" = { | |||
brightness = 0.75; | |||
noise-amount = 0; | |||
}; | |||
}; | |||
} | |||
]; | |||
}; | |||
} | |||
</nowiki>}} | |||
Same result can be achieved for specific user only by using [[Home Manager]] module. | |||
< | {{file|~/.config/home-manager/home.nix|nix|<nowiki> | ||
{ | { | ||
dconf = { | dconf = { | ||
Line 55: | Line 97: | ||
settings = { | settings = { | ||
"org/gnome/shell" = { | "org/gnome/shell" = { | ||
disable-user-extensions = false; | |||
enabled-extensions = [ | enabled-extensions = [ | ||
pkgs.gnomeExtensions.blur-my-shell.extensionUuid | |||
"blur-my-shell@aunetx" | "blur-my-shell@aunetx" | ||
# | # ... | ||
]; | ]; | ||
}; | }; | ||
"org/gnome/shell/extensions/blur-my-shell" = { | "org/gnome/shell/extensions/blur-my-shell" = { | ||
brightness = 0.75; | brightness = 0.75; | ||
Line 70: | Line 112: | ||
}; | }; | ||
} | } | ||
</ | </nowiki>}} | ||
To learn about settings that can be configured with dconf either look into "dconf editor" program or type < | To learn about settings that can be configured with dconf either look into "dconf-editor" program (provided by <code>gnome.dconf-editor</code> package) or type <code>dconf watch /</code> in the terminal and change settings from the GUI and see which options are responsible for that component/element. | ||
=== Dark mode === | === Dark mode === | ||
Line 78: | Line 120: | ||
Change default color theme for all GTK4 applications to dark using [[Home Manager]]. | Change default color theme for all GTK4 applications to dark using [[Home Manager]]. | ||
< | {{file|~/.config/home-manager/home.nix|nix|<nowiki> | ||
{ | { | ||
dconf = { | dconf = { | ||
Line 85: | Line 127: | ||
}; | }; | ||
} | } | ||
</ | </nowiki>}} | ||
== Tips and tricks == | == Tips and tricks == | ||
Line 101: | Line 143: | ||
you should enable dconf module: | you should enable dconf module: | ||
<syntaxHighlight lang=nix> | <syntaxHighlight lang="nix"> | ||
programs.dconf.enable = true; | { | ||
programs.dconf.enable = true; | |||
} | |||
</syntaxHighlight> | </syntaxHighlight> | ||
Many applications rely heavily on having an icon theme available, GNOME’s Adwaita is a good choice but most recent icon themes should work as well. | Many applications rely heavily on having an icon theme available, GNOME’s Adwaita is a good choice but most recent icon themes should work as well. | ||
<syntaxHighlight lang=nix> | <syntaxHighlight lang="nix"> | ||
environment.systemPackages = [ gnome.adwaita-icon-theme ]; | { | ||
environment.systemPackages = with pkgs; [ gnome.adwaita-icon-theme ]; | |||
} | |||
</syntaxHighlight> | </syntaxHighlight> | ||
=== Systray Icons === | === Systray Icons === | ||
To get systray icons, install the related | To get systray icons, install the related GNOME shell extension | ||
<syntaxHighlight lang=nix> | <syntaxHighlight lang="nix"> | ||
environment.systemPackages = | { | ||
environment.systemPackages = [ pkgs.gnomeExtensions.appindicator ]; | |||
} | |||
</syntaxHighlight> | </syntaxHighlight> | ||
And ensure gnome-settings-daemon udev rules are enabled : | And ensure gnome-settings-daemon udev rules are enabled: | ||
<syntaxHighlight lang=nix> | <syntaxHighlight lang="nix"> | ||
services.udev.packages = | { | ||
services.udev.packages = [ pkgs.gnome.gnome-settings-daemon ]; | |||
} | |||
</syntaxHighlight> | </syntaxHighlight> | ||
Line 129: | Line 179: | ||
Some old applications use GConf service to store configuration. This has been deprecated for many years but some applications were abandoned before they managed to upgrade to a newer dconf system. If you are running such application and getting an error like: | Some old applications use GConf service to store configuration. This has been deprecated for many years but some applications were abandoned before they managed to upgrade to a newer dconf system. If you are running such application and getting an error like: | ||
<syntaxHighlight lang=text> | <syntaxHighlight lang="text"> | ||
GLib.GException: Failed to contact configuration server; the most common cause is a missing or misconfigured D-Bus session bus daemon. See http://projects.gnome.org/gconf/ for information | GLib.GException: Failed to contact configuration server; the most common cause is a missing or misconfigured D-Bus session bus daemon. See http://projects.gnome.org/gconf/ for information | ||
</syntaxHighlight> | </syntaxHighlight> | ||
Line 135: | Line 185: | ||
you need to add {{ic|gnome2.GConf}} to the list of dbus packages in your {{ic|configuration.nix}}: | you need to add {{ic|gnome2.GConf}} to the list of dbus packages in your {{ic|configuration.nix}}: | ||
<syntaxHighlight lang=nix> | <syntaxHighlight lang="nix"> | ||
services.dbus.packages = with pkgs; [ gnome2.GConf ]; | { | ||
services.dbus.packages = with pkgs; [ gnome2.GConf ]; | |||
} | |||
</syntaxHighlight> | </syntaxHighlight> | ||
Line 142: | Line 194: | ||
=== Dynamic triple buffering === | === Dynamic triple buffering === | ||
{{Warning|Dynamic triple buffering is a still developing feature that is not merged into GNOME's mutter. Some bugs and unexpected behavior can occur. Use at your own risk!}} | |||
Big [https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441 merge request] against Mutter improves the performance of the window manager by a lot (and is already used by Ubuntu). Not merged into nixpkgs due to [https://github.com/NixOS/nixpkgs/issues/197181 philosophy of nixpkgs], but users are free to add this overlay to get it too. | Big [https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441 merge request] against Mutter improves the performance of the window manager by a lot (and is already used by Ubuntu). Not merged into nixpkgs due to [https://github.com/NixOS/nixpkgs/issues/197181 philosophy of nixpkgs], but users are free to add this overlay to get it too. | ||
If you wish to try this patch for yourself, add the following to your NixOS configuration: | |||
< | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
{ | { | ||
nixpkgs.overlays = [ | nixpkgs.overlays = [ | ||
# GNOME 46: triple-buffering-v4-46 | |||
(final: prev: { | (final: prev: { | ||
gnome = prev.gnome.overrideScope ( | gnome = prev.gnome.overrideScope (gnomeFinal: gnomePrev: { | ||
mutter = gnomePrev.mutter.overrideAttrs (old: { | |||
src = pkgs.fetchFromGitLab { | |||
domain = "gitlab.gnome.org"; | |||
owner = "vanvugt"; | |||
repo = "mutter"; | |||
rev = "triple-buffering-v4-46"; | |||
hash = "sha256-fkPjB/5DPBX06t7yj0Rb3UEuu5b9mu3aS+jhH18+lpI="; | |||
}; | |||
}); | |||
}); | |||
}) | }) | ||
]; | ]; | ||
} | } | ||
</ | </nowiki>}} | ||
You might need to disable aliases to make it work: | You might need to disable aliases to make it work: | ||
<syntaxHighlight lang=nix> | <syntaxHighlight lang="nix"> | ||
nixpkgs.config.allowAliases = false; | nixpkgs.config.allowAliases = false; | ||
</syntaxHighlight> | </syntaxHighlight> | ||
Line 177: | Line 232: | ||
Install {{ic|sysprof}} as a ''system'' package (it won't work properly if installed against users). Then enable the associated service with | Install {{ic|sysprof}} as a ''system'' package (it won't work properly if installed against users). Then enable the associated service with | ||
<syntaxHighlight lang=nix> | <syntaxHighlight lang="nix"> | ||
services.sysprof.enable = true; | services.sysprof.enable = true; | ||
</syntaxHighlight> | </syntaxHighlight> | ||
=== Automatic screen rotation === | === Automatic screen rotation === | ||
<syntaxHighlight lang=nix> | <syntaxHighlight lang="nix"> | ||
hardware.sensor.iio.enable = true; | hardware.sensor.iio.enable = true; | ||
</syntaxHighlight> | </syntaxHighlight> | ||
Line 192: | Line 247: | ||
Currently there is no way to change the user's profile picture using Gnome Control Center [https://github.com/NixOS/nixpkgs/issues/10025 (see this issue)] and currently there is no plan to support it officially in NixOS. However, you can modify it by copying the profile picture that you want to the path '''/home/$USER/.face''' as a workaround, i.e. | Currently there is no way to change the user's profile picture using Gnome Control Center [https://github.com/NixOS/nixpkgs/issues/10025 (see this issue)] and currently there is no plan to support it officially in NixOS. However, you can modify it by copying the profile picture that you want to the path '''/home/$USER/.face''' as a workaround, i.e. | ||
<syntaxHighlight lang=console> | <syntaxHighlight lang="console"> | ||
$ mv /path/to/image.jpg ~/.face | $ mv /path/to/image.jpg ~/.face | ||
</syntaxHighlight> | </syntaxHighlight> | ||
=== | === Automatic login === | ||
If you have enabled [https://help.gnome.org/admin/system-admin-guide/stable/login-automatic.html.en auto login] (with <!-- [[GDM]] -->[[{{PAGENAME}}]]) with something like | If you have enabled [https://help.gnome.org/admin/system-admin-guide/stable/login-automatic.html.en auto login] (with <!-- [[GDM]] -->[[{{PAGENAME}}]]) with something like | ||
: <syntaxHighlight lang=bash> | : <syntaxHighlight lang="bash"> | ||
grep autoLogin /etc/nixos/configuration.nix | grep autoLogin /etc/nixos/configuration.nix | ||
</syntaxHighlight> | </syntaxHighlight> | ||
<syntaxHighlight lang=nix> | <syntaxHighlight lang="nix"> | ||
services.xserver.displayManager.autoLogin.enable = true; | services.xserver.displayManager.autoLogin.enable = true; | ||
services.xserver.displayManager.autoLogin.user = "account"; | services.xserver.displayManager.autoLogin.user = "account"; | ||
Line 208: | Line 263: | ||
than add the following (as a workaround for a current (2023)<ref>https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229</ref> problem) | than add the following (as a workaround for a current (2023)<ref>https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229</ref> problem) | ||
: <syntaxHighlight lang=console># nano /etc/nixos/configuration.nix</syntaxHighlight> | : <syntaxHighlight lang=console># nano /etc/nixos/configuration.nix</syntaxHighlight> | ||
<syntaxHighlight lang=nix> | <syntaxHighlight lang="nix"> | ||
systemd.services."getty@tty1".enable = false; | systemd.services."getty@tty1".enable = false; | ||
systemd.services."autovt@tty1".enable = false; | systemd.services."autovt@tty1".enable = false; | ||
</syntaxHighlight> | </syntaxHighlight> | ||
== Also see == | == Also see == |