diff --git a/hosts/monolith/amdgpu.nix b/hosts/monolith/amdgpu.nix new file mode 100644 index 0000000..c02af7e --- /dev/null +++ b/hosts/monolith/amdgpu.nix @@ -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" + ''; +} diff --git a/hosts/monolith/default.nix b/hosts/monolith/default.nix index ff2b193..962addc 100644 --- a/hosts/monolith/default.nix +++ b/hosts/monolith/default.nix @@ -23,7 +23,7 @@ in imports = [ (modulesPath + "/installer/scan/not-detected.nix") ./partition.nix - ./undervolt.nix + ./amdgpu.nix ]; boot.initrd.availableKernelModules = [ "nvme" @@ -52,28 +52,12 @@ in "amdgpu" "zenpower" ]; - boot.kernelParams = [ - "amdgpu.dcdebugmask=0x10" # amdgpu undervolting bug - "video=DP-1:1920x1080@144" - ]; + systemd.sleep.extraConfig = '' HibernateDelaySec=30s 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" = { device = "/dev/disk/by-label/BTRFS_ROOT"; fsType = "btrfs"; diff --git a/hosts/monolith/undervolt.nix b/hosts/monolith/undervolt.nix deleted file mode 100644 index 9f60aee..0000000 --- a/hosts/monolith/undervolt.nix +++ /dev/null @@ -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" - ''; -}