irqbalance: using systemd service definition from the package itself

This commit is contained in:
snicket2100 2020-02-02 18:09:45 +01:00
parent a5ab947003
commit 04bfeeac79
2 changed files with 12 additions and 17 deletions

View File

@ -13,25 +13,10 @@ in
config = mkIf cfg.enable {
systemd.services = {
irqbalance = {
description = "irqbalance daemon";
path = [ pkgs.irqbalance ];
serviceConfig = {
ExecStart = "${pkgs.irqbalance}/bin/irqbalance --foreground";
CapabilityBoundingSet = "";
NoNewPrivileges = "yes";
ReadOnlyPaths = "/";
ReadWritePaths = "/proc/irq";
RestrictAddressFamilies = "AF_UNIX";
RuntimeDirectory = "irqbalance/";
};
wantedBy = [ "multi-user.target" ];
};
};
environment.systemPackages = [ pkgs.irqbalance ];
systemd.packages = [ pkgs.irqbalance ];
};
}

View File

@ -16,6 +16,16 @@ stdenv.mkDerivation rec {
LDFLAGS = "-lncurses";
postInstall =
''
# Systemd service
mkdir -p $out/lib/systemd/system
grep -vi "EnvironmentFile" misc/irqbalance.service >$out/lib/systemd/system/irqbalance.service
substituteInPlace $out/lib/systemd/system/irqbalance.service \
--replace /usr/sbin/irqbalance $out/bin/irqbalance \
--replace ' $IRQBALANCE_ARGS' ""
'';
meta = {
homepage = https://github.com/Irqbalance/irqbalance;
description = "A daemon to help balance the cpu load generated by interrupts across all of a systems cpus";