fix waybar hwmon

This commit is contained in:
mjallen18
2025-11-20 17:42:50 -06:00
parent 585689db43
commit 2c4cc7c6b7
4 changed files with 38 additions and 16 deletions

View File

@@ -336,7 +336,8 @@ in
}; };
temperature = { temperature = {
hwmon-path = cfg.temperature.cpu.hwmonPath; hwmon-path-abs = cfg.temperature.cpu.hwmonPath;
input-filename = cfg.temperature.cpu.hwmonFile;
critical-threshold = 110; critical-threshold = 110;
format-critical = "{temperatureC}°C "; format-critical = "{temperatureC}°C ";
format = "{temperatureC}°C {icon}"; format = "{temperatureC}°C {icon}";
@@ -546,7 +547,8 @@ in
(mkIf cfg.temperature.gpu.enable { (mkIf cfg.temperature.gpu.enable {
"temperature#gpu" = { "temperature#gpu" = {
hwmon-path = cfg.temperature.gpu.hwmonPath; hwmon-path-abs = cfg.temperature.gpu.hwmonPath;
input-filename = cfg.temperature.gpu.hwmonFile;
critical-threshold = 110; critical-threshold = 110;
format-critical = "{temperatureC}°C "; format-critical = "{temperatureC}°C ";
format = "{temperatureC}°C {icon}"; format = "{temperatureC}°C {icon}";

View File

@@ -127,9 +127,14 @@ in
}; };
hwmonPath = mkOption { hwmonPath = mkOption {
type = str; type = str;
default = "/sys/class/hwmon/hwmon4/temp1_input"; default = "/sys/devices/pci0000:00/0000:00:18.3/hwmon";
description = "CPU temperature hwmon path."; description = "CPU temperature hwmon path.";
}; };
hwmonFile = mkOption {
type = str;
default = "temp1_input";
description = "CPU temperature hwmon file.";
};
}; };
}; };
default = { }; default = { };
@@ -145,9 +150,14 @@ in
}; };
hwmonPath = mkOption { hwmonPath = mkOption {
type = str; type = str;
default = "/sys/class/hwmon/hwmon0/temp1_input"; default = "/sys/devices/pci0000:00/0000:00:01.1/0000:01:00.0/0000:02:00.0/0000:03:00.0/hwmon";
description = "GPU temperature hwmon path."; description = "GPU temperature hwmon path.";
}; };
hwmonFile = mkOption {
type = str;
default = "temp1_input";
description = "GPU temperature hwmon file.";
};
}; };
}; };
default = { }; default = { };

View File

@@ -25,7 +25,7 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
boot = { boot = {
kernelModules = [ "nct6775" ]; kernelModules = [ "nct6775" "k10temp" ];
kernelParams = [ (if cfg.enable then "amdgpu.ppfeaturemask=0xffffffff" else null) ]; kernelParams = [ (if cfg.enable then "amdgpu.ppfeaturemask=0xffffffff" else null) ];
}; };
@@ -61,17 +61,26 @@ in
}; };
# nixpkg is broken so need to manually define # nixpkg is broken so need to manually define
systemd.services.lactd = lib.mkIf cfg.lact.enable { systemd.services = {
description = "AMDGPU Control Daemon"; load-k10temp = {
path = with pkgs; [ description = "Load k10temp manually cause it wont otherwise";
bash script = ''
lact ${pkgs.kmod}/bin/modprobe k10temp
]; '';
script = '' wantedBy = [ "multi-user.target" ];
lact daemon };
''; lactd = lib.mkIf cfg.lact.enable {
wantedBy = [ "multi-user.target" ]; description = "AMDGPU Control Daemon";
after = [ "multi-user.target" ]; path = with pkgs; [
bash
lact
];
script = ''
lact daemon
'';
wantedBy = [ "multi-user.target" ];
after = [ "multi-user.target" ];
};
}; };
# Configure environment # Configure environment

View File

@@ -11,6 +11,7 @@ in
"kvm-amd" "kvm-amd"
"i2c-dev" "i2c-dev"
"ddcci_backlight" "ddcci_backlight"
"k10temp"
]; ];
extraModulePackages = [ config.boot.kernelPackages.ddcci-driver ]; extraModulePackages = [ config.boot.kernelPackages.ddcci-driver ];
loader = { loader = {