flake: move grapics settings into graphics.nix
This commit is contained in:
parent
d3b1ea15aa
commit
3d8f490672
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
|
# monitor configuration
|
||||||
./monitors.nix
|
./monitors.nix
|
||||||
|
|
||||||
./hardware.nix
|
|
||||||
];
|
];
|
||||||
|
|
||||||
options.modules.system = {
|
options.modules.system = {
|
||||||
|
|
|
@ -1,38 +1,37 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
inherit (lib.modules) mkIf;
|
||||||
|
inherit (lib.options) mkEnableOption;
|
||||||
|
|
||||||
cfg = config.modules.system.hardware;
|
cfg = config.modules.system.hardware;
|
||||||
inherit (lib) mkIf;
|
|
||||||
inherit (lib.modules) mkForce;
|
|
||||||
in {
|
in {
|
||||||
|
options.modules.system.hardware = {
|
||||||
|
nvidia = {
|
||||||
|
enable = mkEnableOption "Nvidia graphics drivers";
|
||||||
|
};
|
||||||
|
amd.enable = mkEnableOption "AMD graphics drivers";
|
||||||
|
};
|
||||||
config = {
|
config = {
|
||||||
hardware = {
|
hardware = {
|
||||||
graphics = {
|
graphics.enable = true;
|
||||||
enable = true;
|
|
||||||
extraPackages = mkIf cfg.amd.enable (builtins.attrValues {
|
|
||||||
inherit
|
|
||||||
(pkgs)
|
|
||||||
mesa
|
|
||||||
libva
|
|
||||||
vaapiVdpa
|
|
||||||
;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
nvidia = mkIf cfg.nvidia.enable {
|
nvidia = mkIf cfg.nvidia.enable {
|
||||||
|
# we want the open-source drivers
|
||||||
|
open = true;
|
||||||
|
|
||||||
modesetting.enable = true;
|
modesetting.enable = true;
|
||||||
open = mkForce true;
|
nvidiaSettings = false;
|
||||||
|
|
||||||
|
# fixes sleep on nvidia devices
|
||||||
powerManagement = {
|
powerManagement = {
|
||||||
enable = true;
|
enable = true;
|
||||||
finegrained = false;
|
finegrained = false;
|
||||||
};
|
};
|
||||||
nvidiaSettings = false;
|
|
||||||
package = config.boot.kernelPackages.nvidiaPackages.beta;
|
package = config.boot.kernelPackages.nvidiaPackages.beta;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
boot.initrd.kernelModules = mkIf cfg.amd.enable ["amdgpu"];
|
|
||||||
services.xserver.videoDrivers = mkIf cfg.nvidia.enable ["nvidia"];
|
services.xserver.videoDrivers = mkIf cfg.nvidia.enable ["nvidia"];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue