Max: Add fan control based on temp.
This commit is contained in:
parent
52144e42ab
commit
2837c4bf85
|
@ -1,19 +0,0 @@
|
||||||
{
|
|
||||||
__findFile,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
wm2fc = pkgs.callPackage <package/wm2fc> {};
|
|
||||||
in {
|
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
wm2fc
|
|
||||||
];
|
|
||||||
|
|
||||||
security.wrappers.wm2fc = {
|
|
||||||
source = "${wm2fc}/bin/wm2fc";
|
|
||||||
owner = "root";
|
|
||||||
group = "root";
|
|
||||||
setuid = true;
|
|
||||||
permissions = "u+rx,g+x,o+x";
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,17 +1,24 @@
|
||||||
{
|
{
|
||||||
|
__findFile,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}: let
|
||||||
|
tbase = 45;
|
||||||
|
wm2fc = pkgs.callPackage <package/wm2fc> {};
|
||||||
|
in {
|
||||||
# hardware.cpu.amd.ryzen-smu.enable = true;
|
# hardware.cpu.amd.ryzen-smu.enable = true;
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
# SRC: https://github.com/FlyGoat/RyzenAdj
|
# SRC: https://github.com/FlyGoat/RyzenAdj
|
||||||
# ./ryzenadj --stapm-limit=45000 --fast-limit=45000 --slow-limit=45000 --tctl-temp=90
|
# ./ryzenadj --stapm-limit=45000 --fast-limit=45000 --slow-limit=45000 --tctl-temp=90
|
||||||
# ryzenAdj --info
|
# ryzenAdj --info
|
||||||
|
# radg [TEMP]
|
||||||
ryzenadj
|
ryzenadj
|
||||||
|
|
||||||
# SRC: https://github.com/nbfc-linux/nbfc-linux
|
# SRC: https://github.com/nbfc-linux/nbfc-linux
|
||||||
nbfc-linux
|
nbfc-linux
|
||||||
|
|
||||||
|
wm2fc
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.services.radj = {
|
systemd.services.radj = {
|
||||||
|
@ -25,9 +32,58 @@
|
||||||
];
|
];
|
||||||
script = ''
|
script = ''
|
||||||
while true; do
|
while true; do
|
||||||
ryzenadj --tctl-temp=45
|
ryzenadj --tctl-temp=${toString tbase}
|
||||||
sleep 60
|
sleep 60
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd.services.fan = {
|
||||||
|
enable = true;
|
||||||
|
description = "The fan control";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStop = "${wm2fc}/bin/wm2fc a";
|
||||||
|
Type = "simple";
|
||||||
|
};
|
||||||
|
path = with pkgs; [
|
||||||
|
coreutils
|
||||||
|
wm2fc
|
||||||
|
];
|
||||||
|
script = ''
|
||||||
|
while true; do
|
||||||
|
temp=$(cat /sys/devices/pci0000\:00/0000\:00\:18.3/hwmon/*/temp1_input)
|
||||||
|
value=0
|
||||||
|
|
||||||
|
if [ $temp -gt ${toString (tbase+35)}000 ]
|
||||||
|
then value=184
|
||||||
|
elif [ $temp -gt ${toString (tbase+30)}000 ]
|
||||||
|
then value=161
|
||||||
|
elif [ $temp -gt ${toString (tbase+25)}000 ]
|
||||||
|
then value=138
|
||||||
|
elif [ $temp -gt ${toString (tbase+20)}000 ]
|
||||||
|
then value=115
|
||||||
|
elif [ $temp -gt ${toString (tbase+15)}000 ]
|
||||||
|
then value=92
|
||||||
|
elif [ $temp -gt ${toString (tbase+10)}000 ]
|
||||||
|
then value=69
|
||||||
|
elif [ $temp -gt ${toString (tbase+5)}000 ]
|
||||||
|
then value=46
|
||||||
|
elif [ $temp -gt ${toString tbase}000 ]
|
||||||
|
then value=23
|
||||||
|
fi
|
||||||
|
|
||||||
|
wm2fc $value
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# security.wrappers.wm2fc = {
|
||||||
|
# source = "${wm2fc}/bin/wm2fc";
|
||||||
|
# owner = "root";
|
||||||
|
# group = "root";
|
||||||
|
# setuid = true;
|
||||||
|
# permissions = "u+rx,g+x,o+x";
|
||||||
|
# };
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,16 +26,6 @@
|
||||||
};
|
};
|
||||||
sway.extraConfig = [
|
sway.extraConfig = [
|
||||||
"output eDP-1 scale 1.75"
|
"output eDP-1 scale 1.75"
|
||||||
"bindsym $sysmod+0 exec /run/wrappers/bin/wm2fc 0"
|
|
||||||
"bindsym $sysmod+9 exec /run/wrappers/bin/wm2fc a"
|
|
||||||
"bindsym $sysmod+1 exec /run/wrappers/bin/wm2fc 23"
|
|
||||||
"bindsym $sysmod+2 exec /run/wrappers/bin/wm2fc 46"
|
|
||||||
"bindsym $sysmod+3 exec /run/wrappers/bin/wm2fc 69"
|
|
||||||
"bindsym $sysmod+4 exec /run/wrappers/bin/wm2fc 92"
|
|
||||||
"bindsym $sysmod+5 exec /run/wrappers/bin/wm2fc 115"
|
|
||||||
"bindsym $sysmod+6 exec /run/wrappers/bin/wm2fc 138"
|
|
||||||
"bindsym $sysmod+7 exec /run/wrappers/bin/wm2fc 161"
|
|
||||||
"bindsym $sysmod+8 exec /run/wrappers/bin/wm2fc 184"
|
|
||||||
];
|
];
|
||||||
hwmon = {
|
hwmon = {
|
||||||
file = "temp1_input";
|
file = "temp1_input";
|
||||||
|
|
Loading…
Reference in a new issue