Skyler Grey | f2335ec | 2022-11-02 08:10:50 +0000 | [diff] [blame] | 1 | { pkgs, ... }: |
| 2 | let |
| 3 | prime-run = pkgs.writeScriptBin "prime-run" '' |
| 4 | export __NV_PRIME_RENDER_OFFLOAD=1 |
| 5 | export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 |
| 6 | export __GLX_VENDOR_LIBRARY_NAME=nvidia |
| 7 | export __VK_LAYER_NV_optimus=NVIDIA_only |
| 8 | exec "$@" |
| 9 | ''; |
| 10 | in |
| 11 | { |
| 12 | config = { |
Skyler Grey | a1683e3 | 2022-11-03 08:05:34 +0000 | [diff] [blame^] | 13 | services.xserver.videoDrivers = [ "nvidia" ]; |
Skyler Grey | f2335ec | 2022-11-02 08:10:50 +0000 | [diff] [blame] | 14 | hardware = { |
| 15 | opengl.enable = true; |
| 16 | nvidia = { |
| 17 | modesetting.enable = true; |
| 18 | prime = { |
| 19 | offload.enable = true; |
| 20 | intelBusId = "PCI:0:2:0"; |
| 21 | nvidiaBusId = "PCI:1:0:0"; |
| 22 | }; |
| 23 | }; |
| 24 | }; |
| 25 | internal.allowUnfree = [ "nvidia-x11" "nvidia-settings" "cudatoolkit" ]; |
| 26 | }; |
| 27 | home.home.packages = [ pkgs.nvtop prime-run ]; |
| 28 | } |