1{ lib, stdenv, fetchFromGitHub, pandoc, installShellFiles, withManpage ? false, nixosTests }:
2
3stdenv.mkDerivation rec {
4 pname = "earlyoom";
5 version = "1.7";
6
7 src = fetchFromGitHub {
8 owner = "rfjakob";
9 repo = "earlyoom";
10 rev = "v${version}";
11 sha256 = "sha256-8YcT1TTlAet7F1U9Ginda4IApNqkudegOXqm8rnRGfc=";
12 };
13
14 nativeBuildInputs = lib.optionals withManpage [ pandoc installShellFiles ];
15
16 patches = [ ./fix-dbus-path.patch ];
17
18 makeFlags = [ "VERSION=${version}" ];
19
20 installPhase = ''
21 install -D earlyoom $out/bin/earlyoom
22 '' + lib.optionalString withManpage ''
23 installManPage earlyoom.1
24 '';
25
26 passthru.tests = {
27 inherit (nixosTests) earlyoom;
28 };
29
30 meta = with lib; {
31 description = "Early OOM Daemon for Linux";
32 homepage = "https://github.com/rfjakob/earlyoom";
33 license = licenses.mit;
34 platforms = platforms.linux;
35 maintainers = with maintainers; [];
36 };
37}