nixos-config/roles/nvidia.nix

49 lines
1.3 KiB
Nix
Raw Normal View History

2025-04-08 20:11:16 +02:00
{
lib,
pkgs,
config,
...
}:
with lib;
let
cfg = config.liv.nvidia;
2025-04-08 20:11:16 +02:00
in
{
options.liv.nvidia = {
enable = mkEnableOption "Enable NVIDIA drivers";
};
config = mkIf cfg.enable {
services.xserver.videoDrivers = [ "nvidia" ];
hardware = {
nvidia = {
modesetting.enable = true;
powerManagement.enable = false;
powerManagement.finegrained = false;
open = if (config.liv.gui.enable == true) then true else false;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
2025-04-08 20:11:16 +02:00
enableRedistributableFirmware = true;
graphics = {
enable = true;
extraPackages = with pkgs; [
# amdvlk would be the package that would be required for AMD on desktop, since none of the hosts use NVIDIA as a desktop GPU, this is open and uncertain.
];
# For 32 bit applications as well
extraPackages32 = with pkgs; [
# driversi686Linux.amdvlk would be the package that would be required for AMD on desktop, since none of the hosts use NVIDIA as a desktop GPU, this is open and uncertain.
];
};
};
environment.systemPackages = with pkgs; [
# amdvlk
#nvidia-x11
#nvidia-settings
#nvidia-persistenced
nvtopPackages.nvidia
];
};
}