In this article, we will discuss the issue of Gnome 47 not respecting a symbolically linked monitors.xml file in NixOS, and provide a solution to this problem. We will cover the following key concepts:
Key Concepts
- NixOS: A purely functional Linux distribution that aims to make the system declarative.
- Monitors.xml: A file used by Xorg to manage the configuration of multiple monitors.
- Symbolic Link: A special type of file that points to another file or directory.
Issue: Gnome 47 Not Respecting Symbolically Linked Monitors.xml in NixOS
When using NixOS, one might want to keep the monitors.xml file in a separate location, such as ~/.config, and then create a symbolic link to it from the Xorg's default location, /etc/X11/xorg.conf.d/. This is useful when one wants to manage the system declaratively, and keep the configuration files in a centralized location.
However, Gnome 47 does not respect the symbolic link, and instead, looks for the monitors.xml file in its default location. This can cause issues, as the monitors.xml file might not exist in the default location, and as a result, the Gnome display settings might not work as expected.
Solution: Create a Custom Configuration File for Gnome
The solution to this issue is to create a custom configuration file for Gnome, and then set the GNOME_SETTINGS_PROFILE environment variable to the location of this file. This will cause Gnome to look for the monitors.xml file in the custom location, and thus, solve the issue.
Step 1: Create a Custom Configuration File
Create a directory for the custom Gnome configuration file, for example, ~/.config/gnome-settings.
mkdir -p ~/.config/gnome-settings
Next, create a file named settings.json in the directory, and add the following contents to it:
{
"org.gnome.desktop.interface": {
"monitors-xml": "∼/.config/monitors.xml"
}
}
Step 2: Set the GNOME\_SETTINGS\_PROFILE Environment Variable
Set the GNOME_SETTINGS_PROFILE environment variable to the location of the custom configuration file, for example:
export GNOME_SETTINGS_PROFILE=~/.config/gnome-settings/settings.json
This will cause Gnome to look for the monitors.xml file in the custom location, and thus, solve the issue.
- NixOS aims to make the system declarative.
- A symbolic link to
~/.config/monitors.xmlfrom/etc/X11/xorg.conf.d/can help manage the system declaratively. - Gnome 47 does not respect the symbolic link, and instead, looks for the monitors.xml file in its default location.
- To solve this issue, create a custom configuration file for Gnome, and set the
GNOME_SETTINGS_PROFILEenvironment variable to the location of the file.
References
- NixOS: https://nixos.org/
- Monitors.xml: https://wiki.archlinux.org/title/Xrandr#Configuration_with_xorg.conf.d
- Symbolic Link: https://en.wikipedia.org/wiki/Symbolic\_link
- Gnome: https://gnome.org/