[graphics] Modularizes graphics config. Applies it to vega.
This commit is contained in:
50
system/features/graphics.nix
Normal file
50
system/features/graphics.nix
Normal file
@@ -0,0 +1,50 @@
|
||||
{ config, lib, ... }:
|
||||
{
|
||||
options =
|
||||
with lib;
|
||||
with types;
|
||||
{
|
||||
graphics = {
|
||||
enable = mkEnableOption "graphics support";
|
||||
driverChannel = mkOption {
|
||||
type = str;
|
||||
# Default to production because I often want new features, but I don't want bleeding edge.
|
||||
default = "production";
|
||||
description = "Driver channel to use (in order of oldest to newest): stable, beta, latest";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.graphics.enable {
|
||||
# Graphics settings
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
enable32Bit = true;
|
||||
};
|
||||
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
|
||||
hardware.nvidia = {
|
||||
package = config.boot.kernelPackages.nvidiaPackages."${config.graphics.driverChannel}";
|
||||
|
||||
modesetting.enable = true;
|
||||
|
||||
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
|
||||
# Enable this if you have graphical corruption issues or application crashes after waking
|
||||
# up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
|
||||
# of just the bare essentials.
|
||||
powerManagement.enable = true;
|
||||
|
||||
# Fine-grained power management for PRIME. Turns off GPU when not in use.
|
||||
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
|
||||
# Requires offload to be enabled.
|
||||
# powerManagement.finegrained = false;
|
||||
|
||||
# Use the open-source driver?
|
||||
open = false;
|
||||
|
||||
# Enable the nvidia-settings menu?
|
||||
nvidiaSettings = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user