refactor(treewide)
This commit is contained in:
parent
25d48ac2ac
commit
c4fc882042
99 changed files with 634 additions and 477 deletions
29
nixos/modules/host/hardware/gpu/amd.nix
Normal file
29
nixos/modules/host/hardware/gpu/amd.nix
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
gpu = config.ooknet.host.hardware.gpu;
|
||||
inherit (lib) mkIf mkDefault;
|
||||
inherit (builtins) elem;
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf (elem gpu.type ["amd"]) {
|
||||
hardware.opengl = {
|
||||
extraPackages = with pkgs; [
|
||||
vulkan-tools
|
||||
vulkan-loader
|
||||
vulkan-extension-layer
|
||||
vulkan-validation-layers
|
||||
# amdvlk
|
||||
mesa
|
||||
];
|
||||
extraPackages32 = [ pkgs.driversi686Linux.amdvlk ];
|
||||
};
|
||||
boot = {
|
||||
initrd.kernelModules = ["amdgpu"];
|
||||
kernelModules = ["amdgpu"];
|
||||
};
|
||||
environment.systemPackages = [ pkgs.nvtopPackages.amd ];
|
||||
services.xserver.videoDrivers = mkDefault ["modesetting" "amdgpu"];
|
||||
};
|
||||
}
|
||||
7
nixos/modules/host/hardware/gpu/default.nix
Normal file
7
nixos/modules/host/hardware/gpu/default.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
imports = [
|
||||
./amd.nix
|
||||
./intel.nix
|
||||
./nvidia.nix
|
||||
];
|
||||
}
|
||||
37
nixos/modules/host/hardware/gpu/intel.nix
Normal file
37
nixos/modules/host/hardware/gpu/intel.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
gpu = config.ooknet.host.hardware.gpu;
|
||||
inherit (lib) mkIf;
|
||||
inherit (builtins) elem;
|
||||
|
||||
# vaapiIntel = pkgs.vaapiIntel.override {enableHybridCodec = true;};
|
||||
in
|
||||
|
||||
{
|
||||
config = mkIf (elem gpu.type ["intel"]) {
|
||||
|
||||
services.xserver.videoDrivers = ["modesetting"];
|
||||
hardware.opengl = {
|
||||
extraPackages = with pkgs; [
|
||||
vaapiIntel
|
||||
vaapiVdpau
|
||||
libvdpau-va-gl
|
||||
|
||||
intel-compute-runtime
|
||||
intel-media-driver
|
||||
];
|
||||
extraPackages32 = with pkgs.pkgsi686Linux; [
|
||||
vaapiIntel
|
||||
vaapiVdpau
|
||||
libvdpau-va-gl
|
||||
|
||||
intel-media-driver
|
||||
];
|
||||
};
|
||||
boot.initrd.kernelModules = ["i915"];
|
||||
environment.variables = mkIf config.hardware.opengl.enable {
|
||||
VDPAU_DRIVER = "va_gl";
|
||||
};
|
||||
};
|
||||
}
|
||||
51
nixos/modules/host/hardware/gpu/nvidia.nix
Normal file
51
nixos/modules/host/hardware/gpu/nvidia.nix
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
gpu = config.ooknet.host.hardware.gpu;
|
||||
inherit (lib) mkIf mkDefault;
|
||||
inherit (builtins) elem;
|
||||
production = config.boot.kernelPackages.nvidiaPackages.production;
|
||||
# beta = config.boot.kernelPackages.nvidiaPackages.beta;
|
||||
in
|
||||
|
||||
{
|
||||
# TODO: make option to choose nvidia package
|
||||
config = mkIf (elem gpu.type ["nvidia"]) {
|
||||
hardware = {
|
||||
nvidia = {
|
||||
open = mkDefault true;
|
||||
package = production;
|
||||
forceFullCompositionPipeline = true;
|
||||
nvidiaSettings = false;
|
||||
nvidiaPersistenced = true;
|
||||
modesetting.enable = true;
|
||||
powerManagement = {
|
||||
enable = mkDefault true;
|
||||
finegrained = mkDefault false;
|
||||
};
|
||||
};
|
||||
opengl = {
|
||||
extraPackages = with pkgs; [ nvidia-vaapi-driver ];
|
||||
extraPackages32 = with pkgs.pkgsi686Linux; [ nvidia-vaapi-driver ];
|
||||
};
|
||||
};
|
||||
environment.systemPackages = with pkgs; [
|
||||
|
||||
libva
|
||||
libva-utils
|
||||
|
||||
vulkan-loader
|
||||
vulkan-validation-layers
|
||||
vulkan-tools
|
||||
vulkan-extension-layer
|
||||
|
||||
mesa
|
||||
|
||||
nvtopPackages.nvidia
|
||||
];
|
||||
environment.sessionVariables = {
|
||||
LIBVA_DRIVER_NAME = "nvidia";
|
||||
NVD_BACKEND = "direct";
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue