mirror of
https://github.com/NixOS/nixos-hardware
synced 2024-11-13 22:49:41 +01:00
291c3ee610
This is now provided in nixpkgs (see https://github.com/NixOS/nixpkgs/pull/318175).
34 lines
997 B
Nix
34 lines
997 B
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
{
|
|
options.hardware.amdgpu.loadInInitrd = lib.mkEnableOption (lib.mdDoc
|
|
"loading `amdgpu` kernelModule at stage 1. (Add `amdgpu` to `boot.initrd.kernelModules`)"
|
|
) // {
|
|
default = true;
|
|
};
|
|
options.hardware.amdgpu.opencl = lib.mkEnableOption (lib.mdDoc
|
|
"rocm opencl runtime (Install rocmPackages.clr and rocmPackages.clr.icd)"
|
|
) // {
|
|
default = true;
|
|
};
|
|
|
|
config = lib.mkMerge [
|
|
{
|
|
services.xserver.videoDrivers = lib.mkDefault [ "modesetting" ];
|
|
|
|
hardware.opengl = {
|
|
driSupport = lib.mkDefault true;
|
|
driSupport32Bit = lib.mkDefault true;
|
|
};
|
|
}
|
|
(lib.mkIf config.hardware.amdgpu.loadInInitrd {
|
|
boot.initrd.kernelModules = [ "amdgpu" ];
|
|
})
|
|
(lib.mkIf config.hardware.amdgpu.opencl {
|
|
hardware.opengl.extraPackages =
|
|
if pkgs ? rocmPackages.clr
|
|
then with pkgs.rocmPackages; [ clr clr.icd ]
|
|
else with pkgs; [ rocm-opencl-icd rocm-opencl-runtime ];
|
|
})
|
|
];
|
|
}
|