Nvidia Optimus on dell 3590 : AD107GLM [RTX 500 Ada Generation Laptop GPU]

Your PRIME config seems incomplete to me. In addition to the busIDs, you must choose a GPU mode (offload or sync). For example:

hardware.nvidia.prime = {
  offload.enable = true;
  offload.enableOffloadCmd = true; # install `nvidia-offload`

  intelBusId = "PCI:0:2:0";
  nvidiaBusId = "PCI:1:0:0";
};

If that still doesn’t work, try setting the busIDs to:

intelBusId = "0@0:2:0";
nvidiaBusId = "1@0:0:0";

As suggested in Issues with nvidia-powerd.service and Optimus PRIME offloading on NixOS - #3 by marmar. With this, the intel GPU will be used by default for rendering and you can use the Nvidia GPU with nvidia-offload command.

If you’d like to use Nvidia for rendering by default, you could try inverting the busID order (haven’t verified if this works):

intelBusId = "1@0:2:0";
nvidiaBusId = "0@0:0:0";

or set the following env variables:

environment.variables = {
  GBM_BACKEND = "nvidia-drm";
  __GLX_VENDOR_LIBRARY_NAME = "nvidia";
};

You can specify which driver version you’d like to use with:

hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
  version = "565.57.01"; # beta
  sha256_64bit = "sha256-buvpTlheOF6IBPWnQVLfQUiHv4GcwhvZW3Ks0PsYLHo=";
  sha256_aarch64 = "sha256-aDVc3sNTG4O3y+vKW87mw+i9AqXCY29GVqEIUlsvYfE=";
  openSha256 = "sha256-/tM3n9huz1MTE6KKtTCBglBMBGGL/GOHi5ZSUag4zXA=";
  settingsSha256 = "sha256-H7uEe34LdmUFcMcS6bz7sbpYhg9zPCb/5AmZZFTx1QA=";
  persistencedSha256 = "sha256-hdszsACWNqkCh8G4VBNitDT85gk9gJe1BlQ8LdrYIkg=";
};

You can get the hashes either from the nvidia-x11 derivation or if they’re not available there for a certain version, you can set them to empty strings, rebuild your system and you’ll find the correct hash printed in the console.