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.

35 lines
990 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. # NOTE: You may need to use either of the commands below:
  22. services.xserver.videoDrivers = [ "nvidia" ];
  23. # services.xserver.videoDrivers = [ "modesetting" "nvidia" ];
  24. # Configure `offload-mode'.
  25. hardware.nvidia.prime = {
  26. offload.enable = true;
  27. intelBusId = myIntelBusId;
  28. nvidiaBusId = myNvidiaBusId;
  29. };
  30. }