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