From 9e0da9a1d2d16d0de34ec46eb67af1630bb0072a Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 12 Apr 2026 11:59:43 +0200 Subject: [PATCH] feat(aragon): add thermal monitoring with thermald, mcelog and lm_sensors --- hosts/aragon/configuration.nix | 1 + hosts/aragon/hardware-configuration.nix | 11 ++---- hosts/galadriel/hardware-configuration.nix | 4 +++ modules/thermal.nix | 40 ++++++++++++++++++++++ 4 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 modules/thermal.nix diff --git a/hosts/aragon/configuration.nix b/hosts/aragon/configuration.nix index 2ae366c..b102334 100644 --- a/hosts/aragon/configuration.nix +++ b/hosts/aragon/configuration.nix @@ -19,6 +19,7 @@ ../../modules/pam.nix ../../modules/polkit.nix ../../modules/zram.nix + ../../modules/thermal.nix # Networking and remote access ../../modules/openssh.nix diff --git a/hosts/aragon/hardware-configuration.nix b/hosts/aragon/hardware-configuration.nix index 17a06c1..e61103a 100644 --- a/hosts/aragon/hardware-configuration.nix +++ b/hosts/aragon/hardware-configuration.nix @@ -53,17 +53,12 @@ enable = true; extraPackages = with pkgs; [ rocmPackages.clr.icd + vulkan-loader + vulkan-tools + vulkan-headers ]; }; - # Enable Vulkan support - hardware.opengl.enable = true; - hardware.opengl.extraPackages = with pkgs; [ - vulkan-loader - vulkan-tools - vulkan-headers - ]; - # You *can* still put utilities here environment.systemPackages = with pkgs; [ vulkan-tools diff --git a/hosts/galadriel/hardware-configuration.nix b/hosts/galadriel/hardware-configuration.nix index 390f4c1..21020c0 100644 --- a/hosts/galadriel/hardware-configuration.nix +++ b/hosts/galadriel/hardware-configuration.nix @@ -49,12 +49,16 @@ enable = true; extraPackages = with pkgs; [ vpl-gpu-rt + mkl #hardware decode and opencl intel-media-driver # LIBVA_DRIVER_NAME=iHD (for HD Graphics starting Broadwell (2014) and newer) intel-vaapi-driver # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) libvdpau-va-gl intel-compute-runtime + intel-ocl + intel-graphics-compiler + level-zero vulkan-loader vulkan-validation-layers diff --git a/modules/thermal.nix b/modules/thermal.nix new file mode 100644 index 0000000..ae71db1 --- /dev/null +++ b/modules/thermal.nix @@ -0,0 +1,40 @@ +{ + config, + pkgs, + lib, + ... +}: + +{ + services.lm_sensors.enable = true; + services.thermald.enable = true; + services.mcelog.enable = true; + + environment.systemPackages = with pkgs; [ + lm_sensors + mcelog + ]; + + systemd.services.thermal-log = { + description = "Periodic thermal logging to journal"; + serviceConfig.Type = "oneshot"; + path = with pkgs; [ + lm_sensors + gnugrep + coreutils + ]; + script = '' + TEMP=$(sensors 2>/dev/null | grep -i 'Tctl\|Tdie' | head -1 || echo "N/A") + logger -t thermal-log "CPU Temp: $TEMP" + ''; + }; + + systemd.timers.thermal-log = { + wantedBy = [ "timers.target" ]; + timerConfig = { + OnBootSec = "5min"; + OnUnitActiveSec = "5min"; + Persistent = true; + }; + }; +}