blob: ba69b72b3babf910908df7d5b4116cfe30971769 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
{
lib,
fetchFromGitHub,
installShellFiles,
pandoc,
stdenv,
nixosTests,
# Boolean flags
withManpage ? true,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "earlyoom";
version = "1.8";
src = fetchFromGitHub {
owner = "rfjakob";
repo = "earlyoom";
rev = "v${finalAttrs.version}";
hash = "sha256-jgNoYOGor2i3ngDuU3It238n5ky+AppzlRKdkwXb2AI=";
};
outputs = [ "out" ] ++ lib.optionals withManpage [ "man" ];
patches = [ ./0000-fix-dbus-path.patch ];
nativeBuildInputs = lib.optionals withManpage [
installShellFiles
pandoc
];
makeFlags = [
"VERSION=${finalAttrs.version}"
];
installPhase = ''
runHook preInstall
install -D earlyoom $out/bin/earlyoom
'' + lib.optionalString withManpage ''
installManPage earlyoom.1
'' + ''
runHook postInstall
'';
passthru.tests = {
inherit (nixosTests) earlyoom;
};
meta = {
homepage = "https://github.com/rfjakob/earlyoom";
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;
};
})
|