monolith: extract amdgpu config
This commit is contained in:
parent
411b55cb24
commit
ca0c093ecd
37
hosts/monolith/amdgpu.nix
Normal file
37
hosts/monolith/amdgpu.nix
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
let
|
||||||
|
undervoltGpu = pkgs.writeShellScript "undervolt-gpu" ''
|
||||||
|
set -xe
|
||||||
|
cd $1
|
||||||
|
echo "manual" > power_dpm_force_performance_level
|
||||||
|
echo "1" > pp_power_profile_mode
|
||||||
|
test -e pp_od_clk_voltage
|
||||||
|
echo "vo -120" > pp_od_clk_voltage
|
||||||
|
echo "c" > pp_od_clk_voltage
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
{
|
||||||
|
boot.initrd.kernelModules = [ "amdgpu" ];
|
||||||
|
boot.kernelParams = [
|
||||||
|
"amdgpu.dcdebugmask=0x10" # amdgpu undervolting bug
|
||||||
|
"video=DP-1:1920x1080@144"
|
||||||
|
"amdgpu.ppfeaturemask=0xfffd7fff" # enable undervolting
|
||||||
|
];
|
||||||
|
|
||||||
|
hardware.opengl.driSupport = true;
|
||||||
|
# # For 32 bit applications
|
||||||
|
hardware.opengl.driSupport32Bit = true;
|
||||||
|
|
||||||
|
hardware.opengl.extraPackages = with pkgs; [
|
||||||
|
libva
|
||||||
|
libvdpau
|
||||||
|
vaapiVdpau
|
||||||
|
rocm-opencl-icd
|
||||||
|
rocm-opencl-runtime
|
||||||
|
rocmPackages.rocm-smi
|
||||||
|
];
|
||||||
|
|
||||||
|
services.udev.extraRules = ''
|
||||||
|
ACTION=="add", SUBSYSTEM=="hwmon", ATTR{name}=="amdgpu", ATTR{power1_cap}="186000000", RUN+="${undervoltGpu} %S%p/device"
|
||||||
|
'';
|
||||||
|
}
|
|
@ -23,7 +23,7 @@ in
|
||||||
imports = [
|
imports = [
|
||||||
(modulesPath + "/installer/scan/not-detected.nix")
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
./partition.nix
|
./partition.nix
|
||||||
./undervolt.nix
|
./amdgpu.nix
|
||||||
];
|
];
|
||||||
boot.initrd.availableKernelModules = [
|
boot.initrd.availableKernelModules = [
|
||||||
"nvme"
|
"nvme"
|
||||||
|
@ -52,28 +52,12 @@ in
|
||||||
"amdgpu"
|
"amdgpu"
|
||||||
"zenpower"
|
"zenpower"
|
||||||
];
|
];
|
||||||
boot.kernelParams = [
|
|
||||||
"amdgpu.dcdebugmask=0x10" # amdgpu undervolting bug
|
|
||||||
"video=DP-1:1920x1080@144"
|
|
||||||
];
|
|
||||||
systemd.sleep.extraConfig = ''
|
systemd.sleep.extraConfig = ''
|
||||||
HibernateDelaySec=30s
|
HibernateDelaySec=30s
|
||||||
SuspendState=mem
|
SuspendState=mem
|
||||||
'';
|
'';
|
||||||
|
|
||||||
hardware.opengl.driSupport = true;
|
|
||||||
# # For 32 bit applications
|
|
||||||
hardware.opengl.driSupport32Bit = true;
|
|
||||||
|
|
||||||
hardware.opengl.extraPackages = with pkgs; [
|
|
||||||
libva
|
|
||||||
libvdpau
|
|
||||||
vaapiVdpau
|
|
||||||
rocm-opencl-icd
|
|
||||||
rocm-opencl-runtime
|
|
||||||
rocmPackages.rocm-smi
|
|
||||||
];
|
|
||||||
|
|
||||||
fileSystems."/mnt/old" = {
|
fileSystems."/mnt/old" = {
|
||||||
device = "/dev/disk/by-label/BTRFS_ROOT";
|
device = "/dev/disk/by-label/BTRFS_ROOT";
|
||||||
fsType = "btrfs";
|
fsType = "btrfs";
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
{ pkgs, ... }:
|
|
||||||
let
|
|
||||||
undervoltGpu = pkgs.writeShellScript "undervolt-gpu" ''
|
|
||||||
set -xe
|
|
||||||
cd $1
|
|
||||||
echo "manual" > power_dpm_force_performance_level
|
|
||||||
echo "1" > pp_power_profile_mode
|
|
||||||
test -e pp_od_clk_voltage
|
|
||||||
echo "vo -120" > pp_od_clk_voltage
|
|
||||||
echo "c" > pp_od_clk_voltage
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
{
|
|
||||||
boot.kernelParams = [ "amdgpu.ppfeaturemask=0xfffd7fff" ];
|
|
||||||
services.udev.extraRules = ''
|
|
||||||
ACTION=="add", SUBSYSTEM=="hwmon", ATTR{name}=="amdgpu", ATTR{power1_cap}="186000000", RUN+="${undervoltGpu} %S%p/device"
|
|
||||||
'';
|
|
||||||
}
|
|
Loading…
Reference in a new issue