{ config, lib, ... }: let cfg = config.my.hardware.nvidia; in { options.my.hardware.nvidia = { enable = lib.mkEnableOption "NVIDIA proprietary driver configuration"; package = lib.mkOption { type = lib.types.nullOr lib.types.package; default = null; description = "NVIDIA driver package, or null to use the kernel's default."; }; nvidiaSettings = lib.mkOption { type = lib.types.bool; default = false; description = "Whether to enable the nvidia-settings GUI tool."; }; powerManagement = lib.mkOption { type = lib.types.bool; default = true; description = "Whether to enable NVIDIA power management (persistence mode)."; }; enable32Bit = lib.mkOption { type = lib.types.bool; default = true; description = "Whether to enable 32-bit OpenGL/Vulkan libraries."; }; }; config = lib.mkIf cfg.enable { hardware.graphics = { enable = true; enable32Bit = cfg.enable32Bit; }; services.xserver.videoDrivers = [ "nvidia" ]; hardware.nvidia = { modesetting.enable = true; open = false; # Proprietary driver (pre-Turing/legacy architectures) nvidiaSettings = cfg.nvidiaSettings; powerManagement.enable = cfg.powerManagement; package = lib.mkIf (cfg.package != null) cfg.package; }; }; }