I showed you my source code, pls respond
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
880 B

  1. { config, pkgs, ... }:
  2. let
  3. myIntelBusId = "PCI:0:2:0";
  4. myNvidiaBusId = "PCI:1:0:0";
  5. myNvidiaOffload = pkgs.writeShellScriptBin "nvidia-offload" ''
  6. export __NV_PRIME_RENDER_OFFLOAD=1
  7. export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
  8. export __GLX_VENDOR_LIBRARY_NAME=nvidia
  9. export __VK_LAYER_NV_optimus=NVIDIA_only
  10. exec -a "$0" "$@"
  11. '';
  12. in {
  13. # Add the offload script to the $PATH.
  14. environment.systemPackages = [ myNvidiaOffload ];
  15. # Configure XDG compliance.
  16. environment.variables = {
  17. __GL_SHADER_DISK_CACHE_PATH = "$XDG_CACHE_HOME/nv";
  18. CUDA_CACHE_PATH = "$XDG_CACHE_HOME/nv";
  19. };
  20. # Enable the NVIDIA drivers.
  21. services.xserver.videoDrivers = [ "modesetting" "nvidia" ];
  22. # Configure `offload-mode'.
  23. hardware.nvidia.prime = {
  24. offload.enable = true;
  25. intelBusId = myIntelBusId;
  26. nvidiaBusId = myNvidiaBusId;
  27. };
  28. }