Using the existing xorg.conf.d files

I’m in the process of switching to NixOS and would like to migrate my old Xorg.conf.d files. I want to get the FreeSync and proper acceleration/scrolling.

So far I have tried the following:

  • Copying the contents to services.xserver.config
  • Copying the contents to services.xserver.extraConfig
  • Copying the files into the folder itself

None of the options worked so far, meaning that there is no effect when I start the user WM.

The following is the relevant part of the configuration file:

  services.xserver = {
  enable = true;
  videoDrivers = [ "amdgpu" ];
  libinput.enable= true;
  config = ''
    Section "InputClass"
      Identifier      "Kensington SlimBlade"
      MatchIsPointer  "on"
      Option          "AccelProfile"      "flat"
      Option          "AccelSpeed"        "0"
      Option          "ScrollMethod"      "button"
      Option          "ScrollButton"      "8"
      Option          "MiddleEmulation"   "true"
    EndSection
    Section "Device"
      Identifier     "AMD"
      Option         "VariableRefresh"   "true"
    EndSection
  '';

Additionally I tried ending each line with \n, but then Xorg refuses to start.

What is the correct way of doing this?

1 Like

@eichhorn , I am also struggling with making X work, I wonder, did you find where the xorg.conf file was written to? I am not able to find it on my system.

I don’t know about earlier, but nowadays it seems Xorg is passed the configuration file explicitly:

$ systemctl status display-manager
● display-manager.service - X11 Server
     Loaded: loaded (/nix/store/61sd1n1q13pycraxhvm2v6cxk2w3d8j4-unit-display-manager.service/display-manager.service; linked; vendor preset: enabled)
     Active: active (running) since Wed 2021-08-11 19:23:51 EEST; 3 days ago
   Main PID: 1287 (lightdm)
         IP: 0B in, 0B out
         IO: 90.2M read, 1.2M written
      Tasks: 28 (limit: 38439)
     Memory: 174.3M
        CPU: 1h 13min 19.958s
     CGroup: /system.slice/display-manager.service
             ├─1287 /nix/store/2lr0y3nzqzh1p0xbjj60sv622zxpvv9p-lightdm-1.30.0/sbin/lightdm
             └─1488 /nix/store/j9a11ai05jwga463sfjs4j05p0cfhv2d-xorg-server-1.20.13/bin/X -config /nix/store/104dd6d587976dya8dh37wwh5s4z2v1h-xserver.conf -xkbdir /nix/store/r6z8appffdik21xp3jd3hq6ny>

Aug 11 19:23:50 kktdr systemd[1]: Starting X11 Server...
Aug 11 19:23:51 kktdr systemd[1]: Started X11 Server.
Aug 11 19:23:51 kktdr lightdm[1795]: pam_unix(lightdm-autologin:session): session opened for user eeva(uid=1000) by (uid=0)

Zooming in on X -config /nix/store/104dd6d587976dya8dh37wwh5s4z2v1h-xserver.conf

1 Like

I found that if you enable this setting:

services.xserver.exportConfiguration = true;

The configuration will be written to: /etc/X11/xorg.conf

as a symlink.

Necro’ing a bit here, but I figured this needed resolution. You can apply a configuration to the device section of the config via services.xserver.deviceSection. There’s also an undocumented option which specifiers deviceSections per driver (i.e.: services.xserver.drivers.amdgpu.deviceSection). Not certain exactly when these were put in, but it’s certainly there in nixos-unstable right now.

1 Like

These should probably be documented, that’s a bug.