systems/machines/hermes/hardware.nix
2025-12-14 00:24:47 +01:00

43 lines
1.3 KiB
Nix

{ pkgs, ... }:
let
no-rgb = pkgs.writeScriptBin "no-rgb" ''
#!/bin/sh
NUM_DEVICES=$(${pkgs.openrgb}/bin/openrgb --list-devices | grep -E '^[0-9]+: ' | wc -l)
for i in $(seq 0 $(($NUM_DEVICES - 1))); do
${pkgs.openrgb}/bin/openrgb --device $i --mode static --color 000000
done
'';
in
{
environment.systemPackages = with pkgs; [
i2c-tools
lm_sensors
];
boot.kernelModules = [ "i2c-dev" ];
boot.blacklistedKernelModules = [
# The spd5118 driver is in conflict with openrgb by holding onto I2C adresses when using Kingston Fury DRAM.
# On boot, I need to access those i2c regions in other to poweroff the RGB lighting.
# Then, I manually enable the kernel module in any script.
# It's possible to let this module disabled, but I lose the ability to get temperature values for the DIMMs.
# https://gitlab.com/CalcProgrammer1/OpenRGB/-/merge_requests/2557
"spd5118"
];
hardware.i2c.enable = true;
# OpenRGB
services.udev.packages = [ pkgs.openrgb ];
services.hardware.openrgb.enable = true;
systemd.services.no-rgb = {
description = "no-rgb";
serviceConfig = {
ExecStart = "${no-rgb}/bin/no-rgb";
Type = "oneshot";
};
after = [ "openrgb.service" ];
requires = [ "openrgb.service" ];
wantedBy = [ "multi-user.target" ];
};
}