1{ stdenv, fetchFromGitHub, utillinux }:
2
3stdenv.mkDerivation rec {
4 name = "mcelog-${version}";
5 version = "154";
6
7 src = fetchFromGitHub {
8 owner = "andikleen";
9 repo = "mcelog";
10 rev = "v${version}";
11 sha256 = "0vq7r3zknr62rmi9g0zd7mmxframm79vmrdw029pc7z6wrlv40cy";
12 };
13
14 postPatch = ''
15 for i in mcelog.conf paths.h; do
16 substituteInPlace $i --replace /etc $out/etc
17 done
18 touch mcelog.conf.5 # avoid regeneration requiring Python
19
20 substituteInPlace Makefile --replace '"unknown"' '"${version}"'
21
22 for i in triggers/*; do
23 substituteInPlace $i --replace 'logger' '${utillinux}/bin/logger'
24 done
25 '';
26
27 enableParallelBuilding = true;
28
29 installFlags = [ "DESTDIR=$(out)" "prefix=" "DOCDIR=/share/doc" ];
30
31 postInstall = ''
32 mkdir -p $out/lib/systemd/system
33 substitute mcelog.service $out/lib/systemd/system/mcelog.service \
34 --replace /usr/sbin $out/bin
35 '';
36
37 meta = with stdenv.lib; {
38 description = "Log x86 machine checks: memory, IO, and CPU hardware errors";
39 longDescription = ''
40 The mcelog daemon accounts memory and some other errors in various ways
41 on modern x86 Linux systems. The daemon can be queried and/or execute
42 triggers when configurable error thresholds are exceeded. This is used to
43 implement a range of automatic predictive failure analysis algorithms,
44 including bad page offlining and automatic cache error handling. All
45 errors are logged to /var/log/mcelog or syslog or the journal.
46 '';
47 homepage = http://mcelog.org/;
48 license = licenses.gpl2;
49 platforms = platforms.linux;
50 };
51}