mirror of
https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git
synced 2026-07-21 20:41:25 +02:00
base/irqbalance: only start on multi-socket machines
This commit is contained in:
@@ -1,4 +1,22 @@
|
|||||||
{ ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.services.irqbalance;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
services.irqbalance.enable = true;
|
services.irqbalance.enable = true;
|
||||||
|
|
||||||
|
# irqbalance only has meaningful work to do on multi-socket machines, so
|
||||||
|
# skip starting it pointlessly everywhere else.
|
||||||
|
systemd.services.irqbalance.serviceConfig.ExecCondition = let
|
||||||
|
isMultiSocket = pkgs.writeShellApplication {
|
||||||
|
name = "irqbalance-is-multi-socket";
|
||||||
|
runtimeInputs = [ pkgs.coreutils ];
|
||||||
|
text = ''
|
||||||
|
sockets=$(cat /sys/devices/system/cpu/cpu*/topology/physical_package_id | sort -u | wc -l)
|
||||||
|
[ "$sockets" -gt 1 ]
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in lib.mkIf cfg.enable [
|
||||||
|
(lib.getExe isMultiSocket)
|
||||||
|
];
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user