blob: 8d2f004c4cf10288237980a7eeaf97e4ae375b31 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
{
config,
options,
lib,
pkgs,
...
}: let
gpuConfig = config.modules.hardware.gpu;
device = config.modules.device;
in {
options.modules.hardware.gpu = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
};
};
config = lib.mkIf (gpuConfig.enable) (lib.mkMerge [
{
hardware.graphics = {
enable = true;
};
}
(lib.mkIf (device.gpu == "intel") {
boot.initrd.kernelModules = ["i915"];
services.xserver.videoDrivers = ["modesetting"];
hardware.opengl.extraPackages = [
pkgs.intel-compute-runtime
pkgs.intel-media-driver
pkgs.vaapiIntel
pkgs.vaapiVdpau
pkgs.libvdpau-va-gl
];
environment.variables.VDPAU_DRIVER = "va_gl";
})
(lib.mkIf (device.gpu == "nvidia") {
services.xserver.videoDrivers = ["nvidia"];
boot.initrd.kernelModules = [ "nvidia" ];
hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = false;
powerManagement.finegrained = false;
open = false;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.latest;
};
environment.systemPackages = with pkgs; [
nvtopPackages.nvidia
];
})
]);
}
|