Skip to content

Commit d2f40f8

Browse files
committed
graphics (amd): Make accessing graphics card drivers more resilient
For empty facter reports it's possible that neighter hardware nor graphics_card is set.
1 parent e32635b commit d2f40f8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

modules/nixos/graphics/amd.nix

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1-
{lib, config,...}:
1+
{ lib, config, ... }:
22
let
33
cfg = config.facter.detected.graphics.amd;
44
in
55
{
66
options.facter.detected.graphics = {
77
amd.enable = lib.mkEnableOption "Enable the AMD Graphics module" // {
8-
default = builtins.elem "amdgpu" (builtins.map (graphics_card: graphics_card.driver) config.facter.report.hardware.graphics_card);
8+
default =
9+
let
10+
graphicsDrivers = builtins.map (graphics_card: graphics_card.driver) (
11+
config.facter.report.hardware.graphics_card or [ ]
12+
);
13+
in
14+
builtins.elem "amdgpu" graphicsDrivers;
915
};
1016
};
1117
config = lib.mkIf cfg.enable {
12-
services.xserver.videoDrivers = ["amdgpu"];
18+
services.xserver.videoDrivers = [ "amdgpu" ];
1319
};
1420
}

0 commit comments

Comments
 (0)