How do I find the path to the current nvidia-settings executable in my configuration.nix

Hello! Yesterday I installed the latest NixOS on my computer. I have a somewhat old (not legacy) Nvidia GPU, and a somewhat old monitor that does not support the full color range. So, in order for my desktop to not look like a mess, I need to set the color range to limited in my nvidia-settings.

I installed the nvidia graphics by simply copy-pasting the sample from the wiki into my config. The problem is, nvidia-settings needs to be started every time I start a new session. I tried to make a user systemd unit to make it autostart the thing at login, like so:

systemd.user.services.nvidia-apply-settings = {
  wantedBy = [ "default.target" ];
  description = "Apply the nvidia-settings.";
  serviceConfig = {
    Type = "oneshot";
    ExecStart = ''${something}/bin/nvidia-settings --load-config-only'';
  };
};

The problem is, I can’t seem to figure out where to find the executable. The only way I managed to find the path to the package is in the nix repl using this monstrosity:

nix-repl> c = pkgs.nixos /etc/nixos/configuration.nix  
nix-repl> "${(builtins.head (builtins.filter (x: !builtins.isNull (builtins.match "nvidia-settings.+" x.name)) c.config.environment.systemPackages))}"

But, well, it don’t work in configuration.nix and I am pretty sure this is not how I am supposed to do this anyways.

Your something should probably be config.hardware.nvidia.package.settings.

It’s a bit of an unusual pattern to get at a package via config instead of via pkgs, but this pattern ensures that you get the nvidia-settings associated with the driver you’re using (the equivalent pkgs path is probably pkgs.linuxPackages.nvidiaPackages.stable.settings but anything involving linuxPackages might actually have to be linuxPackages_6_6 or something).

Source: https://github.com/NixOS/nixpkgs/blob/31f91738fb4aae351f1ee93300139c751dcf8196/nixos/modules/hardware/video/nvidia.nix (look for what nvidiaSettings does, then follow the identifier definitions)