nixpkgs/pkgs/by-name/ea/earlyoom/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

65 lines
1.5 KiB
Nix
Raw Normal View History

{
lib,
fetchFromGitHub,
installShellFiles,
pandoc,
stdenv,
nixosTests,
# Boolean flags
withManpage ? true,
}:
2017-02-24 05:31:23 +00:00
stdenv.mkDerivation (finalAttrs: {
2020-04-12 09:09:57 +00:00
pname = "earlyoom";
2024-05-10 17:40:28 +00:00
version = "1.8.2";
2017-02-24 05:31:23 +00:00
src = fetchFromGitHub {
owner = "rfjakob";
repo = "earlyoom";
rev = "v${finalAttrs.version}";
2024-05-10 17:40:28 +00:00
hash = "sha256-HZ7llMNdx2u1a6loIFjXt5QNkYpJp8GqLKxDf9exuzE=";
2017-02-24 05:31:23 +00:00
};
outputs = [ "out" ] ++ lib.optionals withManpage [ "man" ];
2020-04-12 09:09:57 +00:00
patches = [ ./0000-fix-dbus-path.patch ];
nativeBuildInputs = lib.optionals withManpage [
installShellFiles
pandoc
];
makeFlags = [
"VERSION=${finalAttrs.version}"
];
2020-04-12 09:09:57 +00:00
2017-02-24 05:31:23 +00:00
installPhase = ''
runHook preInstall
install -D earlyoom $out/bin/earlyoom
2021-01-15 14:45:37 +00:00
'' + lib.optionalString withManpage ''
2020-04-12 09:09:57 +00:00
installManPage earlyoom.1
'' + ''
runHook postInstall
2017-02-24 05:31:23 +00:00
'';
passthru.tests = {
inherit (nixosTests) earlyoom;
};
meta = {
homepage = "https://github.com/rfjakob/earlyoom";
2017-02-24 05:31:23 +00:00
description = "Early OOM Daemon for Linux";
longDescription = ''
earlyoom checks the amount of available memory and free swap up to 10
times a second (less often if there is a lot of free memory). By default
if both are below 10%, it will kill the largest process (highest
oom_score). The percentage value is configurable via command line
arguments.
'';
license = lib.licenses.mit;
mainProgram = "earlyoom";
maintainers = with lib.maintainers; [ AndersonTorres ];
platforms = lib.platforms.linux;
2017-02-24 05:31:23 +00:00
};
})