feat(gui): add graphics driver options
This commit is contained in:
parent
a0f20b9f1a
commit
635d7fd0f3
55
faucet/gui/default.nix
Normal file
55
faucet/gui/default.nix
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
{ pkgs
|
||||||
|
, lib
|
||||||
|
, config
|
||||||
|
, ... }: with lib; let
|
||||||
|
cfg = config.faucet.gui;
|
||||||
|
in {
|
||||||
|
options.faucet.gui = {
|
||||||
|
enable = mkEnableOption "various setup required for GUI and support software";
|
||||||
|
type = mkOption {
|
||||||
|
type = with types; enum [ "intel" "amdgpu" "nvidia" "prime" ];
|
||||||
|
description = "type of graphics acceleration used";
|
||||||
|
};
|
||||||
|
prime = {
|
||||||
|
integrated = mkOption {
|
||||||
|
type = with types; str;
|
||||||
|
default = "i915";
|
||||||
|
description = "integrated gpu driver";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
hardware.opengl = {
|
||||||
|
enable = true;
|
||||||
|
driSupport = true;
|
||||||
|
driSupport32Bit = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
services.xserver.videoDrivers =
|
||||||
|
optional ((cfg.type == "nvidia") || (cfg.type == "prime")) "nvidia" ++
|
||||||
|
optional (cfg.type == "amdgpu") "amdgpu";
|
||||||
|
# has to be enabled even when using wayland
|
||||||
|
services.xserver.enable = true;
|
||||||
|
|
||||||
|
hardware.nvidia = mkIf ((cfg.type == "nvidia") || (cfg.type == "prime")) {
|
||||||
|
modesetting.enable = true;
|
||||||
|
nvidiaSettings = true;
|
||||||
|
|
||||||
|
prime = mkIf (cfg.type == "prime") {
|
||||||
|
offload = {
|
||||||
|
enable = true;
|
||||||
|
enableOffloadCmd = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
powerManagement.enable = false;
|
||||||
|
powerManagement.finegrained = false;
|
||||||
|
open = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
boot.initrd.kernelModules =
|
||||||
|
optional (cfg.type == "amdgpu") "amdgpu" ++
|
||||||
|
optional (cfg.type == "prime") cfg.prime.integrated;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue