about summary refs log tree commit diff
path: root/nixos/modules/services
diff options
context:
space:
mode:
authorJohn Titor <50095635+JohnRTitor@users.noreply.github.com>2024-06-14 23:19:49 +0530
committerJohn Titor <50095635+JohnRTitor@users.noreply.github.com>2024-06-18 10:04:03 +0530
commit6a0b6a6b74a71be7c37b9d8bc4472cf087aff709 (patch)
tree73706243f031d91108e43b7bd207d227d0d3dc7b /nixos/modules/services
parent23bcbb6dfd7ba49ef8d9326f4784f5d83545503e (diff)
nixos/amdgpu: init module
Diffstat (limited to 'nixos/modules/services')
-rw-r--r--nixos/modules/services/hardware/amdgpu.nix43
1 files changed, 43 insertions, 0 deletions
diff --git a/nixos/modules/services/hardware/amdgpu.nix b/nixos/modules/services/hardware/amdgpu.nix
new file mode 100644
index 0000000000000..24016fc646975
--- /dev/null
+++ b/nixos/modules/services/hardware/amdgpu.nix
@@ -0,0 +1,43 @@
+{ config, lib, pkgs, ... }:
+
+let
+  cfg = config.hardware.amdgpu;
+in {
+  options.hardware.amdgpu = {
+    legacySupport.enable = lib.mkEnableOption ''
+      using `amdgpu` kernel driver instead of `radeon` for Southern Islands
+      (Radeon HD 7000) series and Sea Islands (Radeon HD 8000)
+      series cards. Note: this removes support for analog video outputs,
+      which is only available in the `radeon` driver
+    '';
+    initrd.enable = lib.mkEnableOption ''
+      loading `amdgpu` kernelModule in stage 1.
+      Can fix lower resolution in boot screen during initramfs phase
+    '';
+    opencl.enable = lib.mkEnableOption ''OpenCL support using ROCM runtime library'';
+    # cfg.amdvlk option is defined in ./amdvlk.nix module
+  };
+
+  config = {
+    boot.kernelParams = lib.optionals cfg.legacySupport.enable [
+      "amdgpu.si_support=1"
+      "amdgpu.cik_support=1"
+      "radeon.si_support=0"
+      "radeon.cik_support=0"
+    ];
+
+    boot.initrd.kernelModules = lib.optionals cfg.initrd.enable [ "amdgpu" ];
+
+    hardware.opengl = lib.mkIf cfg.opencl.enable {
+      enable = lib.mkDefault true;
+      extraPackages = [
+        pkgs.rocmPackages.clr
+        pkgs.rocmPackages.clr.icd
+      ];
+    };
+  };
+
+  meta = {
+    maintainers = with lib.maintainers; [ johnrtitor ];
+  };
+}