Getting path in /nix/store

I use ${pkgs.gawk}/bin/awk to return the ‘current’ derivation path for awk inside configuration.nix.

Is there a corresponding way to return the ‘current’ derivation path for xserver.conf as I have multiple versions of this file in /nix/store/ and I want to ensure I am always getting the current one?

It depends on how the config file in question is “exported”.

For xorg specifically, you can set services.xserver.exportConfiguration to make the module link the config file into /etc/ and then access it via config.environment.etc."X11/xorg.conf".source.

@Atemu, thanks that works! :smiley: Interesting that enabling this doesn’t actually change the file pointers that are used to start X, not that I care but I sort of expected it to!

Yeah, this option only exports the config for introspection purposes. It’s still being passed directly to the X server.

1 Like

There also seems to be a by-product → system.nixos.tag and system.nixos.label appear to be replaced by Export_X_Configuration which makes it harder to know which specialisation booted!