mirror of
https://github.com/youwen5/nixos.git
synced 2025-01-18 05:02:10 -08:00
feat: manage nvidia graphics as a module
This commit is contained in:
parent
190faacb64
commit
104a61a055
1 changed files with 51 additions and 0 deletions
51
modules/linux/graphics/default.nix
Normal file
51
modules/linux/graphics/default.nix
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.liminalOS.system.graphics;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.liminalOS.system.graphics = {
|
||||||
|
enable = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Whether to set up basic graphics settings and options.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
nvidia = {
|
||||||
|
enable = lib.mkEnableOption "recommended nvidia drivers and configuration";
|
||||||
|
optimus-prime.enable = lib.mkEnableOption "Nvidia OPTIMUS and PRIME";
|
||||||
|
optimus-prime.powerMode = lib.mkOption {
|
||||||
|
type = lib.types.enum [
|
||||||
|
"powersaving"
|
||||||
|
"performance"
|
||||||
|
];
|
||||||
|
default = "performance";
|
||||||
|
description = ''
|
||||||
|
Whether to use Nvidia OPTIMUS with maximum performance using the discrete graphics card, or to use offload mode to primarily use the integrated GPU and save power.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
suppressUnfreeWarning = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to disable the assertion that warns the user if they try to enable proprietary nvidia drivers without setting allowUnfree.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
hardware.nvidia = lib.mkIf cfg.nvidia.enable {
|
||||||
|
modesetting.enable = true;
|
||||||
|
powerManagement.enable = true;
|
||||||
|
powerManagement.finegrained = false;
|
||||||
|
open = true;
|
||||||
|
package = config.boot.kernelPackages.nvidiaPackages.beta;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue