gpu rework

This commit is contained in:
2024-02-26 11:08:16 +01:00
parent 55920896ee
commit 0f4374d4f5
2 changed files with 23 additions and 26 deletions
+14 -12
View File
@@ -2,12 +2,18 @@
{
# assumes common-gpu-nvidia from nixos-hardware is also added
# TODO: should we move it from flake.nix to here?
# https://github.com/NixOS/nixos-hardware/blob/master/common/gpu/nvidia/default.nix
# https://github.com/NixOS/nixos-hardware/blob/master/common/gpu/nvidia/prime.nix
# https://nixos.wiki/wiki/Nvidia
hardware.opengl.enable = true;
hardware.opengl.driSupport = true;
hardware.opengl.driSupport32Bit = true;
#https://nixpk.gs/pr-tracker.html?pr=235481
#nixpkgs.config.cudaSupport = true; # TODO: TOO SLOW, BREAKS
#nixpkgs.config.nvidiaSupport = true; # TODO: slow? used only by zenith
nixpkgs.config.openglSupport = true; # why is this not set by hardware.opengl.enable ?
nixpkgs.config.cudaSupport = true; # TODO: TOO SLOW, BREAKS
nixpkgs.config.vdpauSupport = true;
nixpkgs.config.vaapiSupport = true;
nixpkgs.config.nvidiaSupport = true; # TODO: slow? used only by zenith
nixpkgs.config.allowUnfreePredicate = pkg: lib.any (x: x) [
(lib.hasInfix "nvidia" (lib.toLower (lib.getName pkg)))
@@ -16,23 +22,21 @@
(lib.hasInfix "cublas" (lib.toLower (lib.getName pkg)))
];
hardware.opengl.enable = true;
hardware.opengl.driSupport = true;
hardware.opengl.driSupport32Bit = true;
# https://nixos.wiki/wiki/Nvidia
hardware.opengl.extraPackages = [
#pkgs.vaapiVdpau
#pkgs.vaapiVdpau # added by nixos-hardware
#pkgs.libvdpau-va-gl
pkgs.nvidia-vaapi-driver
];
hardware.nvidia.modesetting.enable = lib.mkDefault true; # needed for most wayland compositors
hardware.nvidia.nvidiaSettings = lib.mkDefault true;
virtualisation.docker.enableNvidia = lib.mkDefault true;
virtualisation.podman.enableNvidia = lib.mkDefault true;
# only do this per-host
# only do these per-host
#hardware.nvidia.open = lib.mkDefault true; # open source version of kernel module, only on driver 515.43.04+
#hardware.nvidia.powerManagement.enable = lib.mkDefault true; # Fix graphical corruption on suspend/resume
@@ -44,7 +48,6 @@
#hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.latest;
#hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.beta;
# add this to the host in question:
#hardware.nvidia.prime = {
# offload.enable = true;
# # Bus IDs. You can find them using lspci, grepping for "3D" or "VGA"
@@ -52,7 +55,6 @@
# nvidiaBusId = "PCI:1:0:0";
#};
environment.systemPackages = [
pkgs.nvtop-nvidia
] ++ lib.optionals config.hardware.nvidia.prime.offload.enable [