refactor(nvidia): remove unneeded declarations and clean up
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-12-31 11:34:14 -05:00
parent 248cdd78e0
commit 0a823fbb1a

View file

@ -4,7 +4,7 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (builtins) toJSON; inherit (builtins) attrValues toJSON;
inherit (lib) mkIf mkEnableOption mkOption optionals optionalString types; inherit (lib) mkIf mkEnableOption mkOption optionals optionalString types;
cfg = config.nvidia; cfg = config.nvidia;
@ -33,7 +33,7 @@ in {
enable = true; enable = true;
enable32Bit = true; enable32Bit = true;
extraPackages = builtins.attrValues { extraPackages = attrValues {
inherit inherit
(pkgs) (pkgs)
vaapiVdpau vaapiVdpau
@ -41,40 +41,28 @@ in {
nvidia-vaapi-driver nvidia-vaapi-driver
; ;
}; };
extraPackages32 = [pkgs.vaapiVdpau]; extraPackages32 = attrValues {
inherit
(pkgs)
vaapiVdpau
;
};
}; };
services.xserver.videoDrivers = ["nvidia"]; services.xserver.videoDrivers = ["nvidia"];
hardware.nvidia = { hardware.nvidia = {
modesetting.enable = true; open = true;
# Enable the Nvidia settings menu, package = config.boot.kernelPackages.nvidiaPackages.latest;
# accessible via `nvidia-settings`.
# Whether to enable nvidia-settings, NVIDIA's GUI configuration tool
nvidiaSettings = cfg.enableNvidiaSettings; nvidiaSettings = cfg.enableNvidiaSettings;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
powerManagement = {
enable = false;
# Fine-grained power management. Turns off GPU when not in use.
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
finegrained = false;
};
open = false;
package = let
inherit (config.boot.kernelPackages.nvidiaPackages) beta stable;
in
if !cfg.enableWayland
then stable
else beta;
}; };
environment.systemPackages = environment.systemPackages =
optionals cfg.enableCUDA [pkgs.cudaPackages.cudatoolkit] optionals cfg.enableCUDA [pkgs.cudaPackages.cudatoolkit]
++ (builtins.attrValues { ++ (attrValues {
inherit (pkgs.nvtopPackages) nvidia; inherit (pkgs.nvtopPackages) nvidia;
inherit inherit
(pkgs) (pkgs)
@ -90,6 +78,7 @@ in {
++ ["nvidia" "nvidia-drm"]; ++ ["nvidia" "nvidia-drm"];
# Fixes egl-wayland issues with beta drivers # Fixes egl-wayland issues with beta drivers
# https://github.com/hyprwm/Hyprland/issues/7202
environment.etc = let environment.etc = let
mkEglFile = n: library: let mkEglFile = n: library: let
suffix = optionalString (library != "wayland") ".1"; suffix = optionalString (library != "wayland") ".1";