refactor: make the whole thing more generic

This commit is contained in:
2024-04-02 16:28:57 +02:00
parent 7b648e1955
commit 651f3ad808
193 changed files with 763 additions and 521 deletions

View File

@@ -0,0 +1,51 @@
{ pkgs, lib, config, ... }:
with lib;
let cfg = config.hardware.nvidia.preset.proprietary;
in {
options.hardware.nvidia.preset.proprietary = {
enable = mkEnableOption
"Enable proprietary NVIDIA driver support with some sane defaults";
};
config = mkIf cfg.enable {
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages = with pkgs; [ libvdpau-va-gl nvidia-vaapi-driver ];
};
services.xserver.videoDrivers = [ "nvidia" ];
boot.kernelParams = [ "nvidia_drm.fbdev=1" ];
boot.kernelModules =
[ "nvidia" "nvidia_modeset" "nvidia_uvm" "nvidia_drm" ];
boot.initrd.kernelModules =
[ "nvidia" "nvidia_modeset" "nvidia_uvm" "nvidia_drm" ];
hardware.nvidia = {
modesetting.enable = true;
# seems to cause crashes on sleep
powerManagement.enable = false;
open = true;
nvidiaSettings = false;
# no idea if this actually does anything...
nvidiaPersistenced = false;
};
environment = {
variables = {
VDPAU_DRIVER = "va_gl";
LIBVA_DRIVER_NAME = "nvidia";
};
systemPackages = with pkgs; [
glxinfo
nvtopPackages.nvidia
libva-utils
vulkan-tools
];
};
};
}