M hosts/alice/default.nix => hosts/alice/default.nix +4 -1
@@ 33,7 33,10 @@
roles.zellij.enable = true;
roles.kitty.enable = true;
- roles.nvidia.enable = true;
+ roles.graphics = {
+ enable = true;
+ nvidia.enable = true;
+ };
roles.plasma.enable = true;
roles.gaming = {
M hosts/arwen/default.nix => hosts/arwen/default.nix +4 -1
@@ 37,7 37,10 @@
roles.zellij.enable = true;
roles.kitty.enable = true;
- roles.amdgpu.enable = true;
+ roles.graphics = {
+ enable = true;
+ amd.enable = true;
+ };
roles.hyprland.enable = true;
roles.gaming = {
M roles/default.nix => roles/default.nix +1 -2
@@ 1,9 1,9 @@
{...}: {
imports = [
./gaming
+ ./graphics
./shell
- ./amdgpu.nix # FIXME: merge with nvidia.nix to graphics/ role
./audio.nix
./bluetooth.nix
./base.nix
@@ 11,7 11,6 @@
./hyprland.nix
./kitty.nix
./nix.nix
- ./nvidia.nix
./plasma.nix
./qutebrowser.nix
./zellij.nix
A roles/graphics/amd.nix => roles/graphics/amd.nix +13 -0
@@ 0,0 1,13 @@
+{
+ config,
+ lib,
+ ...
+}: let
+ cfg = config.roles.graphics;
+in {
+ config = lib.mkIf cfg.amd.enable {
+ boot.initrd.kernelModules = ["amdgpu"];
+
+ services.xserver.videoDrivers = ["amdgpu"];
+ };
+}
R roles/amdgpu.nix => roles/graphics/default.nix +11 -9
@@ 3,22 3,24 @@
lib,
...
}: let
- cfg = config.roles.amdgpu;
+ cfg = config.roles.graphics;
in {
- options.roles.amdgpu = {
- enable = lib.mkEnableOption "AMDGPU drivers";
- };
+ imports = [
+ ./amd.nix
+ ./nvidia.nix
+ ];
+ options.roles.graphics = {
+ enable = lib.mkEnableOption "graphics drivers";
+ amd.enable = lib.mkEnableOption "AMDGPU drivers";
+ nvidia.enable = lib.mkEnableOption "NVIDIA drivers";
+ };
config = lib.mkIf cfg.enable {
- boot.initrd.kernelModules = ["amdgpu"];
-
- services.xserver.videoDrivers = ["amdgpu"];
-
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
};
-}
+ }
R roles/nvidia.nix => roles/graphics/nvidia.nix +2 -12
@@ 3,23 3,13 @@
lib,
...
}: let
- cfg = config.roles.nvidia;
+ cfg = config.roles.graphics;
in {
- options.roles.nvidia = {
- enable = lib.mkEnableOption "NVIDIA drivers";
- };
-
- config = lib.mkIf cfg.enable {
+ config = lib.mkIf cfg.nvidia.enable {
arta.unfree.allow = ["nvidia-x11"];
services.xserver.videoDrivers = ["nvidia"];
- hardware.opengl = {
- enable = true;
- driSupport = true;
- driSupport32Bit = true;
- };
-
hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = true;