Skip to content

Commit e32635b

Browse files
committed
graphics: Introduce amd module
Introduces an AMD graphics specific module. For now this module only adds amdgpu video drivers to xserver.
1 parent 15b6531 commit e32635b

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

modules/nixos/facter.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
./disk.nix
1010
./keyboard.nix
1111
./firmware.nix
12-
./graphics.nix
12+
./graphics
1313
./networking
1414
./system.nix
1515
./virtualisation.nix

modules/nixos/graphics/amd.nix

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{lib, config,...}:
2+
let
3+
cfg = config.facter.detected.graphics.amd;
4+
in
5+
{
6+
options.facter.detected.graphics = {
7+
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);
9+
};
10+
};
11+
config = lib.mkIf cfg.enable {
12+
services.xserver.videoDrivers = ["amdgpu"];
13+
};
14+
}

modules/nixos/graphics.nix renamed to modules/nixos/graphics/default.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
{ lib, config, ... }:
22
let
3-
facterLib = import ../../lib/lib.nix lib;
3+
facterLib = import ../../../lib/lib.nix lib;
44
cfg = config.facter.detected.graphics;
55
in
66
{
7+
imports = [
8+
./amd.nix
9+
];
710
options.facter.detected = {
811
graphics.enable = lib.mkEnableOption "Enable the Graphics module" // {
912
default = builtins.length (config.facter.report.hardware.monitor or [ ]) > 0;

0 commit comments

Comments
 (0)