about summary refs log tree commit diff
path: root/nixos/modules/services
diff options
context:
space:
mode:
authorK900 <me@0upti.me>2024-06-20 14:29:01 +0300
committerGitHub <noreply@github.com>2024-06-20 14:29:01 +0300
commit5ce022e0e00c672ec84db557a4c18bda995dc04a (patch)
tree052e7be985527aaec2e66dbbad6321452fd2552b /nixos/modules/services
parente73ed3f6df7f20a96994ab9597dae896303aedd0 (diff)
parentc508cc5bedbf8e5455670c19362aba8c41ff70c1 (diff)
downloadnixlib-5ce022e0e00c672ec84db557a4c18bda995dc04a.tar
nixlib-5ce022e0e00c672ec84db557a4c18bda995dc04a.tar.gz
nixlib-5ce022e0e00c672ec84db557a4c18bda995dc04a.tar.bz2
nixlib-5ce022e0e00c672ec84db557a4c18bda995dc04a.tar.lz
nixlib-5ce022e0e00c672ec84db557a4c18bda995dc04a.tar.xz
nixlib-5ce022e0e00c672ec84db557a4c18bda995dc04a.tar.zst
nixlib-5ce022e0e00c672ec84db557a4c18bda995dc04a.zip
Merge pull request #319865 from JohnRTitor/amdgpu-module
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 000000000000..24016fc64697
--- /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 ];
+  };
+}