nixpkgs/pkgs/os-specific/linux/earlyoom/default.nix
Naïm Favier a8296e7537
nixos/earlyoom: bring the module up to date (#163663)
* nixos/earlyoom: bring the module up to date

Removes deprecated option `ignoreOOMScoreAdjust`, introduces `killHook`
as a replacement for `notificationsCommand`, and adds an `extraArgs`
option for things not covered by the module.

* nixos/earlyoom: add nixos test

* nixos/earlyoom: add reportInterval

Allows setting the interval for logging a memory report. Defaults to
3600 following upstream
     (https://github.com/rfjakob/earlyoom/blob/master/earlyoom.default#L5)
to avoid flooding logs.

* nixos/earlyoom: add free{Mem,Swap}KillThreshold

Fixes https://github.com/NixOS/nixpkgs/issues/83504
2022-03-24 15:34:09 +08:00

38 lines
927 B
Nix

{ lib, stdenv, fetchFromGitHub, pandoc, installShellFiles, withManpage ? false, nixosTests }:
stdenv.mkDerivation rec {
pname = "earlyoom";
version = "1.7";
src = fetchFromGitHub {
owner = "rfjakob";
repo = "earlyoom";
rev = "v${version}";
sha256 = "sha256-8YcT1TTlAet7F1U9Ginda4IApNqkudegOXqm8rnRGfc=";
};
nativeBuildInputs = lib.optionals withManpage [ pandoc installShellFiles ];
patches = [ ./fix-dbus-path.patch ];
makeFlags = [ "VERSION=${version}" ];
installPhase = ''
install -D earlyoom $out/bin/earlyoom
'' + lib.optionalString withManpage ''
installManPage earlyoom.1
'';
passthru.tests = {
inherit (nixosTests) earlyoom;
};
meta = with lib; {
description = "Early OOM Daemon for Linux";
homepage = "https://github.com/rfjakob/earlyoom";
license = licenses.mit;
platforms = platforms.linux;
maintainers = with maintainers; [];
};
}