Can I downgrade the Nvidia driver?

After an OS upgrade, an application (Sunshine) that uses the GPU no longer functions correctly. When running the application (post system upgrade) it now complains with:

* Error: Failed to create a CUDA device: Unknown error occurred
* Fatal: Couldn't find any encoder matching [nvenc]

When I reboot the machine, and select the previous generation, the application works as expected. I believe I’ve tracked this down to an Nvidia driver upgrade.

I’d like to validate this assumption by pinning the Nvidia driver, however I may have reached the limits of my knowledge on the nix language.

Here is the expression that I would like to override this section:
Context: nixpkgs/default.nix at d0d55259081f0b97c828f38559cad899d351cad1 · NixOS/nixpkgs · GitHub

  production = generic {
    version = "525.89.02";
    sha256_64bit = "sha256-DkEsiMW9mPhCqDmm9kYU8g5MCVDvfP+xKxWKcWM1k+k=";
    openSha256 = "sha256-MP9ir0Fuodar239r3PbqVxIHd0vHvpDj8Rw55TeFtZM=";
    settingsSha256 = "sha256-7rHaJWm0XHJXsKL8VnU9XT15t/DU8jdsCXQwQT+KaV0=";
    persistencedSha256 = "sha256-4AmOL6b3GKCjGs6bRDpQAkEG4n41X395znyQF1x9VEs=";

Here is how i attempted to override the expression:

  hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.production.overrideAttrs (oldAttrs: rec {
    version = "525.60.11";            
    persistencedVersion = "525.60.11"; 
    settingsVersion = "525.60.11"; 
    sha256_64bit = "<some-new-sha256>";  
    openSha256 = "<some-new-sha256>";    
    settingsSha256 = "<some-new-sha256>";    
    persistencedSha256 = "<some-new-sha256>";  
    url = "";

This does not seem to work, as it ignores my inputs and uses whatever the variables are from the nix repository.

Any ideas on how to move forward here?

I do have the old driver in the /nix/store, but i have no idea how or if i can reference the old derivation.


did you take a look at this

hardware.nvidia.package = pkgs.linuxKernel.packages.linux_5_15.nvidia_x11;

That method does not appear to work anymore:

building Nix...
building the system configuration...
Error: attribute 'extend' missing

please upload you configuration into a public git repo , i’ll take a look