Skyler Grey | 6ec7b41 | 2023-01-26 00:38:49 +0000 | [diff] [blame] | 1 | { pkgs, lib, username, ... }: |
Skyler Grey | f2335ec | 2022-11-02 08:10:50 +0000 | [diff] [blame] | 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 | { |
Skyler Grey | e4bca3d | 2023-02-26 13:01:01 +0000 | [diff] [blame] | 12 | /* config = { */ |
| 13 | /* services.xserver.videoDrivers = [ "nvidia" ]; */ |
| 14 | /* hardware = { */ |
| 15 | /* opengl.enable = true; */ |
| 16 | /* nvidia = { */ |
| 17 | /* modesetting.enable = true; */ |
| 18 | /* powerManagement.enable = true; */ |
| 19 | /* prime = { */ |
| 20 | /* offload.enable = true; */ |
| 21 | /* intelBusId = "PCI:0:2:0"; */ |
| 22 | /* nvidiaBusId = "PCI:1:0:0"; */ |
| 23 | /* }; */ |
| 24 | /* }; */ |
| 25 | /* }; */ |
Skyler Grey | 6ec7b41 | 2023-01-26 00:38:49 +0000 | [diff] [blame] | 26 | |
Skyler Grey | e4bca3d | 2023-02-26 13:01:01 +0000 | [diff] [blame] | 27 | /* specialisation.nvidia-sync.configuration = { */ |
| 28 | /* system.nixos.tags = [ "nvidia-sync" ]; */ |
| 29 | /* hardware.nvidia.powerManagement.enable = lib.mkForce false; */ |
| 30 | /* hardware.nvidia.prime.offload.enable = lib.mkForce false; */ |
| 31 | /* hardware.nvidia.prime.sync.enable = lib.mkForce true; */ |
| 32 | /* services.xserver.dpi = 96; */ |
Skyler Grey | 6ec7b41 | 2023-01-26 00:38:49 +0000 | [diff] [blame] | 33 | |
Skyler Grey | e4bca3d | 2023-02-26 13:01:01 +0000 | [diff] [blame] | 34 | /* home-manager.users.${username}.home.file.".xinitrc".text = lib.mkBefore '' */ |
| 35 | /* ${pkgs.xorg.xrandr}/bin/xrandr --setprovideroutputsource modesetting NVIDIA-0 */ |
| 36 | /* ${pkgs.xorg.xrandr}/bin/xrandr --output HDMI-0 --primary --mode 3840x2160 --pos 0x0 --rotate normal --output eDP-1-1 --mode 1920x1080 --pos 960x2160 --rotate normal */ |
| 37 | /* ''; */ |
| 38 | /* }; */ |
Skyler Grey | 6ec7b41 | 2023-01-26 00:38:49 +0000 | [diff] [blame] | 39 | |
Skyler Grey | e4bca3d | 2023-02-26 13:01:01 +0000 | [diff] [blame] | 40 | /* internal.allowUnfree = [ "nvidia-x11" "nvidia-settings" "cudatoolkit" ]; */ |
| 41 | /* }; */ |
| 42 | /* home.home.packages = [ pkgs.nvtop prime-run ]; */ |
Skyler Grey | f2335ec | 2022-11-02 08:10:50 +0000 | [diff] [blame] | 43 | } |