Customising Xorg Screen Section

I’m migrating over from other Linux distros, and ordinarily I would drop my desired screen configuration in /etc/X11/xorg.conf.d and be done with it.

I’ve tried using environment.etc."/etc/X11/xorg.conf.d/20-nvidia.conf" to export the necessary config which places the file correctly, but doesn’t appear to be loaded. I noticed that from using cat /var/log/X.0.log | grep Using.config that nix is using a default configuration file that contains its own screen section and presumably overriding my config file I placed. I also tried setting services.xserver.config = ""; but that doesn’t actually change the configuration file being loaded.

Essentially, I need to get the metamodes line into the Screen config in xorg.conf somehow, or to find a way to disable reading this config file in the first place. The config file actually has a device/monitor section as well, however I thought it best to only show the relevant section.

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-0.8"
    Option         "metamodes" "DP-4: nvidia-auto-select +3840+0 {viewportin=3840x2160}, DP-0.8: nvidia-auto-select +0+0"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24

I am currently using KDE and sddm, although I want to ensure all X window managers/desktop managers have this set correctly.

Does anyone have any suggestions on how to solve this? Thanks in advance."Screen"&patternType=standard&sm=1&groupBy=repo

here arr a few examples here that might be able to help you.


they may not.

Thanks a lot - I’ve never come across that site before, it seems very useful.

I found that services.xserver actually has two components that aren’t documented in the nixos options: deviceSection and screenSection that I was able to get the relevant aspects into.

This worked for SDDM and gnome, so appears to be working correctly! However, KDE is being stubborn and deciding on it’s own screen configuration…

1 Like