27 lines
884 B
Nix
27 lines
884 B
Nix
# NVIDIA for host desktop; when `chiasson.system.vm.gpuPassthrough` is enabled, drop NVIDIA for VFIO (port later).
|
|
{ config, lib, pkgs, ... }:
|
|
let
|
|
passthrough = config.chiasson.system.vm.gpuPassthrough.enable;
|
|
in
|
|
{
|
|
boot.kernelParams = [ "snd_hda_core.gpu_bind=0" ];
|
|
boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
|
|
|
|
services.xserver.videoDrivers = if passthrough then [ "modesetting" ] else [ "nvidia" ];
|
|
|
|
hardware.nvidia =
|
|
if passthrough then
|
|
lib.mkForce { }
|
|
else {
|
|
modesetting.enable = true;
|
|
powerManagement.enable = false;
|
|
powerManagement.finegrained = false;
|
|
open = true;
|
|
nvidiaSettings = true;
|
|
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
|
};
|
|
|
|
# Needed for `docker compose` GPU passthrough (e.g. `--gpus all` / DEVICE=gpu).
|
|
hardware.nvidia-container-toolkit.enable = !passthrough;
|
|
}
|