summaryrefslogtreecommitdiff
path: root/nix_archive/nix/amdgpu.nix
blob: 3d28b1d05fc3963cd455f5839e3cf62ba86e5572 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{ pkgs, ... }: {
  boot.kernelParams = [ "amdgpu.ppfeaturemask=0xffffffff" ];
  environment.sessionVariables = with pkgs; {
    VDPAU_DRIVER = "radeonsi";
    LIBVA_DRIVER_NAME = "radeonsi";
    AMD_VULKAN_ICD = "RADV";
    VK_ICD_FILENAMES="${pkgsi686Linux.mesa}/share/vulkan/icd.d/radeon_icd.i686.json:${mesa}/share/vulkan/icd.d/radeon_icd.x86_64.json";
    __EGL_VENDOR_LIBRARY_FILENAMES="${pkgsi686Linux.mesa}/share/glvnd/egl_vendor.d/50_mesa.json:${mesa}/share/glvnd/egl_vendor.d/50_mesa.json";
  };
  environment.systemPackages = with pkgs; [
    radeontop
    (writeShellScriptBin "proton-env-amdvlk" ''
      export AMD_VULKAN_ICD="AMDVLK"
      export VK_ICD_FILENAMES="${amdvlk}/share/vulkan/icd.d/amd_icd64.json"
      proton-env "$@"
    '')
  ];
  security.wrappers = {
    radeontop = {
      owner = "root";
      group = "root";
      source = "${pkgs.radeontop}/bin/radeontop";
      capabilities = "cap_perfmon+ep";
    };
  };
  # https://github.com/sibradzic/amdgpu-clocks
  # @TODO: Fetch and patch scripts from the git repo.
  #environment.etc = { # XFX RX 6600
  #  "default/amdgpu-custom-states.card0".text = ''
  #    OD_VDDGFX_OFFSET:
  #    -55mV
  #    FORCE_POWER_CAP: 120000000
  #    FORCE_PERF_LEVEL: auto
  #    FORCE_POWER_PROFILE: 1
  #  '';
  #};
  #environment.systemPackages = [ amdgpu-clocks pkgs.radeontop ];
  #systemd.services.amdgpu-clocks = {
  #  description = "Set custom amdgpu clocks & voltages";
  #  after = [ "multi-user.target" "rc-local.service" "systemd-user-sessions.service" ];
  #  wants = [ "modprobe@amdgpu.service" ];
  #  wantedBy = [ "multi-user.target" ];
  #  serviceConfig = {
  #    Type = "oneshot";
  #    ExecStart = "${amdgpu-clocks}/bin/amdgpu-clocks";
  #    ExecStop = "${amdgpu-clocks}/bin/amdgpu-clocks restore";
  #    ExecReload = "${amdgpu-clocks}/bin/amdgpu-clocks";
  #    RemainAfterExit = true;
  #  };
  #};
}