flake: move grapics settings into graphics.nix
This commit is contained in:
parent
388104ce88
commit
617966a6cc
3 changed files with 16 additions and 29 deletions
|
@ -1,10 +0,0 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib) mkOption mkEnableOption;
|
||||
in {
|
||||
options.modules.system.hardware = {
|
||||
nvidia = {
|
||||
enable = mkEnableOption "Nvidia Nvidia graphics drivers";
|
||||
};
|
||||
amd.enable = mkEnableOption "AMD graphics drivers";
|
||||
};
|
||||
}
|
|
@ -29,8 +29,6 @@ in {
|
|||
|
||||
# monitor configuration
|
||||
./monitors.nix
|
||||
|
||||
./hardware.nix
|
||||
];
|
||||
|
||||
options.modules.system = {
|
||||
|
|
|
@ -1,38 +1,37 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.options) mkEnableOption;
|
||||
|
||||
cfg = config.modules.system.hardware;
|
||||
inherit (lib) mkIf;
|
||||
inherit (lib.modules) mkForce;
|
||||
in {
|
||||
options.modules.system.hardware = {
|
||||
nvidia = {
|
||||
enable = mkEnableOption "Nvidia graphics drivers";
|
||||
};
|
||||
amd.enable = mkEnableOption "AMD graphics drivers";
|
||||
};
|
||||
config = {
|
||||
hardware = {
|
||||
graphics = {
|
||||
enable = true;
|
||||
extraPackages = mkIf cfg.amd.enable (builtins.attrValues {
|
||||
inherit
|
||||
(pkgs)
|
||||
mesa
|
||||
libva
|
||||
vaapiVdpa
|
||||
;
|
||||
});
|
||||
};
|
||||
graphics.enable = true;
|
||||
nvidia = mkIf cfg.nvidia.enable {
|
||||
# we want the open-source drivers
|
||||
open = true;
|
||||
|
||||
modesetting.enable = true;
|
||||
open = mkForce true;
|
||||
nvidiaSettings = false;
|
||||
|
||||
# fixes sleep on nvidia devices
|
||||
powerManagement = {
|
||||
enable = true;
|
||||
finegrained = false;
|
||||
};
|
||||
nvidiaSettings = false;
|
||||
package = config.boot.kernelPackages.nvidiaPackages.beta;
|
||||
};
|
||||
};
|
||||
boot.initrd.kernelModules = mkIf cfg.amd.enable ["amdgpu"];
|
||||
services.xserver.videoDrivers = mkIf cfg.nvidia.enable ["nvidia"];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue