How to use an existing xorg.conf, rather than a nixos-generated one?


I would like to know if there is a way to use an existing xorg.conf rather than the one that is generated by the nixos modules. Reason being is that I would like to see if a more conventional approach to xorg config will get my egpu to work.

I have tried to set services.xserver.exportConfiguration equal to false so I could copy a file over manually, but it seems that this conflicts with my display manager (startx)


The problem is probably this line, which to me looks like it overrides the config to use the generated one even if you set that option: nixpkgs/xserver.nix at 01e87b327aa89d9d60fba192085bccddaa2d1b24 · NixOS/nixpkgs · GitHub

Maybe that should be considered a bug?

I imagine you can override that with services.xserver.displayManager.xserverArgs = [ "-config" <config> ];, assuming X will override on duplicate args?

1 Like

Unfortunately, this does not seem to be the case. After making these changes, my Xorg.0.log says that it is loading the config directly from the store. (Which kind of invalidates the original idea ) :frowning:

:expressionless: You can try prepending with lib.mkBefore and completely overriding with lib.mkForce too, I think.

Can you see the args X is running with anywhere to confirm? ps should show them while it’s running. If I am indeed correct, the alternative is a quick patch to nixpkgs to fix this.

1 Like

It seems that the args are duplicated which is interesting.

/nix/store/mxg8z2h658hgdpv6gcyyjk4xbnj601gp-xorg-server-1.20.13/bin/X -config /etc/X11/xorg2.conf -config /nix/store/d4k2kxdjhcx376xmmmqqx3ykdmw4npni-xserver.conf -xkbdir /nix/store/mkhijsslpa19kynnhi4cyag3j27k3dw2-xkeyboard-config-2.33/etc/X11/xkb :0 vt7 -dpi 192 -verbose 3 -nolisten tcp -terminate :0 vt1 -keeptty -auth /home/smkuehnhold/.serverauth.1563

My logfile however still says that it is reading the config from the store, so I wonder if there is a defined precedence.

It seems from a quick test that X uses the later definition of config. So by using lib.mkAfter instead, I was able to point to the existing xorg.conf within my filesystem. And with that manual config, I was finally able to get an output from my eGPU (or at least I was able to get my monitor connected to my eGPU to display a screen) :tada:

1 Like

A bit off-topic, but do you have any knowledge of xserver configuration? If so, I’d appreciate your help over on the other thread. My manual config and the one generated via nixos are not that different, so I don’t expect it to be a lot of work to diagnose the issue.

I’ve dabbled, I’ll take a look some time; I live near GMT so should probably not be browsing the discourse at this hour :wink:

I think this is worth an upstream issue, too, by the way. You shouldn’t need to override the config twice. I’ll make one tomorrow, and a quick patch while I’m at it.

1 Like