refactor(hardware): major refactor of hardware modules

This commit is contained in:
ooks-io 2024-04-08 17:30:42 +12:00
parent 8f229750b0
commit 4a177d2122
18 changed files with 95 additions and 191 deletions

View file

@ -1,29 +0,0 @@
{ lib, config, pkgs, ... }:
let
cfg = config.systemProfile.amd;
in
{
config = lib.mkIf cfg.enable {
hardware.opengl = {
extraPackages = with pkgs; [
vulkan-tools
vulkan-loader
vulkan-extension-layer
vulkan-validation-layer
amdvlk
mesa
];
extraPackages32 = [ pkgs.driversi686Linux.amdvlk ];
};
boot = {
initrd.kernelModules = ["amdgpu"];
kernelModules = ["amdgpu"];
};
environment.systemPackages = [ pkgs.nvtopPackages.amd ];
};
}

View file

@ -1,6 +1,7 @@
{ inputs, outputs, lib, config, pkgs, ... }:
let
isx86Linux = pkgs: with pkgs.stdenv; hostPlatform.isLinux && hostPlatform.isx86;
cfg = config.systemProfile.base;
in
@ -51,17 +52,8 @@ in
enableAllFirmware = true;
opengl = {
enable = true;
extraPackages = with pkgs; [
intel-media-driver
vaapiIntel
vaapiVdpau
libvdpau-va-gl
libva-utils
];
extraPackages32 = with pkgs.pkgsi686Linux; [
vaapiVdpau
libvdpau-va-gl
];
driSupport = true;
driSupport32Bit = isx86Linux pkgs;
};
};
system.stateVersion = lib.mkDefault "23.11";

View file

@ -9,11 +9,8 @@ in
{
imports = [
./base
./nvidia
./gaming
./laptop
./mediaServer
./amd
];
options = {
@ -29,15 +26,6 @@ in
gaming = {
enable = lib.mkEnableOption "Enable the gaming profile";
};
laptop = {
enable = lib.mkEnableOption "Enable the laptop profile";
};
nvidia = {
enable = lib.mkEnableOption "Enable the nvidia profile";
};
amd = {
enable = lib.mkEnableOption "Enable the amd profile";
};
mediaServer = {
enable = lib.mkEnableOption "Enable the mediaServer profile";
};

View file

@ -1,19 +0,0 @@
{ config, lib, ... }:
let
cfg = config.systemProfile.laptop;
in
{
imports = [
../../modules
];
config = lib.mkIf cfg.enable {
systemModules = {
hardware = {
bluetooth.enable = true;
backlight.enable = true;
};
laptop.power.enable = true;
};
};
}

View file

@ -1,40 +0,0 @@
{ lib, config, pkgs, ... }:
let
cfg = config.systemProfile.nvidia;
production = config.boot.kernelPackages.nvidiaPackages.production;
beta = config.boot.kernelPackages.nvidiaPackages.beta;
in
{
config = lib.mkIf cfg.enable {
hardware.nvidia = {
open = true;
package = production;
modesetting.enable = true;
nvidiaSettings = true;
powerManagement.enable = true;
};
hardware.opengl.extraPackages = with pkgs; [ nvidia-vaapi-driver ];
hardware.opengl.extraPackages32 = with pkgs.pkgsi686Linux; [ nvidia-vaapi-driver ];
services.xserver.videoDrivers = [ "nvidia" ];
environment.sessionVariables = {
LIBVA_DRIVER_NAME = "nvidia";
NVD_BACKEND = "direct";
};
environment.systemPackages = with pkgs; [
nvtopPackages.nvidia
mesa
libva
libva-utils
vulkan-loader
vulkan-validation-layers
vulkan-tools
vulkan-extension-layer
];
};
}