diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/default.nix | 3 | ||||
-rw-r--r-- | scripts/nvidia-offload.nix | 12 |
2 files changed, 15 insertions, 0 deletions
diff --git a/scripts/default.nix b/scripts/default.nix index 220d76d..f134556 100644 --- a/scripts/default.nix +++ b/scripts/default.nix | |||
@@ -36,6 +36,9 @@ let | |||
36 | # battery script | 36 | # battery script |
37 | battery = import ./battery.nix pkgs; | 37 | battery = import ./battery.nix pkgs; |
38 | 38 | ||
39 | # run-on-gpu script | ||
40 | battery = import ./nvidia-offload.nix pkgs; | ||
41 | |||
39 | # fzf script to switch between tmux sessions | 42 | # fzf script to switch between tmux sessions |
40 | tmux-fzf = pkgs.writeScriptBin "tmux-fzf" '' | 43 | tmux-fzf = pkgs.writeScriptBin "tmux-fzf" '' |
41 | LIST_DATA="#{session_name}/#{window_name}/#{pane_current_command} @ #{pane_current_path}" | 44 | LIST_DATA="#{session_name}/#{window_name}/#{pane_current_command} @ #{pane_current_path}" |
diff --git a/scripts/nvidia-offload.nix b/scripts/nvidia-offload.nix new file mode 100644 index 0000000..de55fa2 --- /dev/null +++ b/scripts/nvidia-offload.nix | |||
@@ -0,0 +1,12 @@ | |||
1 | { pkgs, ... }: | ||
2 | |||
3 | let | ||
4 | name = "nvidia-offload"; | ||
5 | in | ||
6 | pkgs.writeShellScriptBin name '' | ||
7 | export __NV_PRIME_RENDER_OFFLOAD=1 | ||
8 | export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 | ||
9 | export __GLX_VENDOR_LIBRARY_NAME=nvidia | ||
10 | export __VK_LAYER_NV_optimus=NVIDIA_only | ||
11 | exec "$@" | ||
12 | '' | ||