Extend nvidia role to include driver configuration
The nvidia role now handles full driver configuration instead of just packages. Added options for open driver, modesetting, power management, graphics settings, and driver package selection. Updated zix790prors and wixos machine configs to use the new role options, removing duplicated hardware.nvidia configuration blocks. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,15 @@
|
||||
enable = true;
|
||||
wayland = true;
|
||||
};
|
||||
nvidia = {
|
||||
enable = true;
|
||||
package = "latest";
|
||||
graphics.extraPackages = with pkgs; [
|
||||
mesa
|
||||
libvdpau-va-gl
|
||||
libva-vdpau-driver
|
||||
];
|
||||
};
|
||||
users.enable = true;
|
||||
};
|
||||
|
||||
@@ -29,28 +38,13 @@
|
||||
wsl.wslConf.network.hostname = "wixos";
|
||||
wsl.wslConf.user.default = "johno";
|
||||
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
|
||||
extraPackages = with pkgs; [
|
||||
mesa
|
||||
libvdpau-va-gl
|
||||
libva-vdpau-driver
|
||||
];
|
||||
};
|
||||
# WSL-specific environment variables for graphics
|
||||
environment.sessionVariables = {
|
||||
LD_LIBRARY_PATH = [
|
||||
"/usr/lib/wsl/lib"
|
||||
"/run/opengl-driver/lib"
|
||||
];
|
||||
};
|
||||
hardware.nvidia = {
|
||||
modesetting.enable = true;
|
||||
nvidiaSettings = true;
|
||||
open = true;
|
||||
package = config.boot.kernelPackages.nvidiaPackages.latest;
|
||||
};
|
||||
|
||||
# This value determines the NixOS release from which the default
|
||||
# settings for stateful data, like file locations and database versions
|
||||
|
||||
@@ -26,7 +26,10 @@ with lib;
|
||||
x11 = true;
|
||||
};
|
||||
nfs-mounts.enable = true;
|
||||
nvidia.enable = true;
|
||||
nvidia = {
|
||||
enable = true;
|
||||
graphics.enable32Bit = true;
|
||||
};
|
||||
printing.enable = true;
|
||||
remote-build.enableBuilder = true;
|
||||
users.enable = true;
|
||||
@@ -47,27 +50,11 @@ with lib;
|
||||
# Fix dual boot clock sync - tell Linux to use local time for hardware clock
|
||||
time.hardwareClockInLocalTime = true;
|
||||
|
||||
# NVIDIA Graphics configuration
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
hardware.graphics.enable = true;
|
||||
hardware.graphics.enable32Bit = true;
|
||||
|
||||
# Set DP-0 as primary display with 164.90Hz refresh rate
|
||||
services.xserver.displayManager.sessionCommands = ''
|
||||
${pkgs.xorg.xrandr}/bin/xrandr --output DP-0 --mode 3440x1440 --rate 164.90 --primary
|
||||
'';
|
||||
|
||||
hardware.nvidia = {
|
||||
modesetting.enable = true;
|
||||
nvidiaSettings = true;
|
||||
package = pkgs.linuxPackages.nvidiaPackages.stable;
|
||||
open = true;
|
||||
|
||||
# For gaming performance
|
||||
powerManagement.enable = false;
|
||||
powerManagement.finegrained = false;
|
||||
};
|
||||
|
||||
services.ollama = {
|
||||
enable = true;
|
||||
acceleration = "cuda";
|
||||
|
||||
@@ -8,9 +8,89 @@ in
|
||||
{
|
||||
options.roles.nvidia = {
|
||||
enable = mkEnableOption "Enable the nvidia role";
|
||||
|
||||
# Driver configuration options
|
||||
open = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Use the open source nvidia kernel driver (for Turing and newer GPUs).";
|
||||
};
|
||||
|
||||
modesetting = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable kernel modesetting for nvidia.";
|
||||
};
|
||||
|
||||
nvidiaSettings = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable the nvidia-settings GUI.";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = types.enum [ "stable" "latest" "beta" "vulkan_beta" "production" ];
|
||||
default = "stable";
|
||||
description = "The nvidia driver package to use.";
|
||||
};
|
||||
|
||||
powerManagement = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enable nvidia power management (useful for laptops, not recommended for desktops).";
|
||||
};
|
||||
|
||||
finegrained = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enable fine-grained power management for Turing and newer GPUs.";
|
||||
};
|
||||
};
|
||||
|
||||
graphics = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Enable hardware graphics support.";
|
||||
};
|
||||
|
||||
enable32Bit = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enable 32-bit graphics libraries (needed for some games).";
|
||||
};
|
||||
|
||||
extraPackages = mkOption {
|
||||
type = types.listOf types.package;
|
||||
default = [];
|
||||
description = "Extra packages to add to hardware.graphics.extraPackages.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# Set xserver video driver
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
|
||||
# Graphics configuration
|
||||
hardware.graphics = {
|
||||
enable = cfg.graphics.enable;
|
||||
enable32Bit = cfg.graphics.enable32Bit;
|
||||
extraPackages = cfg.graphics.extraPackages;
|
||||
};
|
||||
|
||||
# NVIDIA driver configuration
|
||||
hardware.nvidia = {
|
||||
modesetting.enable = cfg.modesetting;
|
||||
nvidiaSettings = cfg.nvidiaSettings;
|
||||
open = cfg.open;
|
||||
package = config.boot.kernelPackages.nvidiaPackages.${cfg.package};
|
||||
powerManagement.enable = cfg.powerManagement.enable;
|
||||
powerManagement.finegrained = cfg.powerManagement.finegrained;
|
||||
};
|
||||
|
||||
# Additional packages for nvidia support
|
||||
environment.systemPackages = with pkgs; [
|
||||
libva-utils
|
||||
nvidia-vaapi-driver
|
||||
|
||||
Reference in New Issue
Block a user