blob: 303d902f19bbf9ba19d26e015685a6072c86f187 (
plain)
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
|
{
config,
lib,
pkgs,
...
}: let
cfg = config.traits.nvidia;
usingNvidia = lib.elem "nvidia" config.services.xserver.videoDrivers;
in {
options.traits.nvidia = {
enable = lib.mkEnableOption "NVIDIA drivers";
nvk.enable = lib.mkEnableOption "NVK specialisation";
};
config = lib.mkIf cfg.enable (lib.mkMerge [
{
boot.kernelParams = lib.optional usingNvidia "nvidia_drm.fbdev=1";
services.xserver.videoDrivers = ["nvidia"];
hardware = {
graphics.extraPackages = [pkgs.vaapiVdpau];
nvidia = {
package = lib.mkDefault config.boot.kernelPackages.nvidiaPackages.latest;
modesetting.enable = true;
};
};
}
(lib.mkIf cfg.nvk.enable {
specialisation = {
nvk.configuration = {
boot = {
kernelParams = ["nouveau.config=NvGspRm=1"];
initrd.kernelModules = ["nouveau"];
};
environment.sessionVariables = {
MESA_VK_VERSION_OVERRIDE = "1.3";
};
hardware.graphics.extraPackages = lib.mkForce [];
services.xserver.videoDrivers = lib.mkForce ["modesetting"];
system.nixos.tags = ["with-nvk"];
};
};
})
]);
}
|