mirror of
https://github.com/NixOS/nixos-hardware
synced 2024-11-30 14:59:43 +01:00
53b470587f
fix #388
26 lines
766 B
Nix
26 lines
766 B
Nix
{ lib, pkgs, ... }:
|
|
|
|
# This creates a new 'nvidia-offload' program that runs the application passed to it on the GPU
|
|
# As per https://nixos.wiki/wiki/Nvidia
|
|
let
|
|
nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" ''
|
|
export __NV_PRIME_RENDER_OFFLOAD=1
|
|
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
|
|
export __GLX_VENDOR_LIBRARY_NAME=nvidia
|
|
export __VK_LAYER_NV_optimus=NVIDIA_only
|
|
exec -a "$0" "$@"
|
|
'';
|
|
in
|
|
{
|
|
services.xserver.videoDrivers = lib.mkDefault [ "nvidia" ];
|
|
environment.systemPackages = [ nvidia-offload ];
|
|
|
|
hardware.nvidia.prime = {
|
|
offload.enable = lib.mkDefault true;
|
|
# Hardware should specify the bus ID for intel/nvidia devices
|
|
};
|
|
|
|
hardware.opengl.extraPackages = with pkgs; [
|
|
vaapiVdpau
|
|
];
|
|
}
|