mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-06 17:57:50 +00:00
Also, use X.org modesetting driver instead of deprecated amdgpu DDX driver.
62 lines
1.7 KiB
Nix
62 lines
1.7 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
with lib;
|
|
let
|
|
cfg = config.aviallon.hardware.amd;
|
|
devCfg = config.aviallon.developer;
|
|
generalCfg = config.aviallon.general;
|
|
in {
|
|
config = mkIf (cfg.enable && cfg.kernelDriver == "amdgpu") {
|
|
boot.initrd.kernelModules = [ "amdgpu" ];
|
|
|
|
aviallon.boot.cmdline = {
|
|
# for Southern Islands (SI ie. GCN 1) cards
|
|
"radeon.si_support" = 0;
|
|
"amdgpu.si_support" = 1;
|
|
# for Sea Islands (CIK ie. GCN 2) cards
|
|
"radeon.cik_support" = 0;
|
|
"amdgpu.cik_support" = 1;
|
|
|
|
"amdgpu.ppfeaturemask" = mkIf generalCfg.unsafeOptimizations "0xfff7ffff";
|
|
#"amdgpu.mes" = mkIf generalCfg.unsafeOptimizations 1;
|
|
"amdgpu.seamless" = mkIf generalCfg.unsafeOptimizations 1;
|
|
};
|
|
|
|
environment.systemPackages = with pkgs; []
|
|
++ [ rocm-smi ]
|
|
++ optionals devCfg.enable [
|
|
rocminfo
|
|
]
|
|
;
|
|
|
|
aviallon.programs.config.rocmSupport = mkDefault devCfg.enable;
|
|
|
|
services.xserver.videoDrivers =
|
|
optional cfg.useProprietary "amdgpu-pro"
|
|
++ [ "modesetting" ];
|
|
|
|
hardware.opengl = {
|
|
enable = true;
|
|
extraPackages = with pkgs; mkIf (!cfg.useProprietary) (
|
|
[
|
|
rocm-opencl-icd
|
|
rocm-opencl-runtime
|
|
]
|
|
++ optional (cfg.defaultVulkanImplementation == "amdvlk") amdvlk
|
|
);
|
|
extraPackages32 = with pkgs.driversi686Linux; mkIf (!cfg.useProprietary) ([]
|
|
++ optional (cfg.defaultVulkanImplementation == "amdvlk") amdvlk
|
|
);
|
|
};
|
|
|
|
environment.variables = {
|
|
"AMD_VULKAN_ICD" = strings.toUpper cfg.defaultVulkanImplementation;
|
|
};
|
|
|
|
# Make rocblas and rocfft work
|
|
nix.settings.extra-sandbox-paths = [
|
|
"/dev/kfd?"
|
|
"/sys/devices/virtual/kfd?"
|
|
"/dev/dri/renderD128?"
|
|
];
|
|
};
|
|
}
|