monolith: extract undervolt config

This commit is contained in:
Leonardo Eugênio 2024-07-06 18:32:29 -03:00
parent 2de6fdb7be
commit b3aadef8cb
2 changed files with 17 additions and 8 deletions

View file

@ -23,6 +23,7 @@ in
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
./partition.nix
./undervolt.nix
];
boot.initrd.availableKernelModules = [
"nvme"
@ -66,14 +67,6 @@ in
boot.kernelPackages = pkgs.linuxPackages_6_1;
programs.corectrl = {
enable = true;
gpuOverclock = {
enable = true;
ppfeaturemask = "0xffffffff";
};
};
fileSystems."/mnt/old" = {
device = "/dev/disk/by-label/BTRFS_ROOT";
fsType = "btrfs";

View file

@ -0,0 +1,16 @@
{ pkgs, ... }:
let
undervoltGpu = pkgs.writeShellScript "undervolt-gpu" ''
set -xe
cd $1
test -e pp_od_clk_voltage
echo "vo -100" > 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"
'';
}