1 { lib, stdenv, fetchFromGitHub, perl
2 , sysfsutils, dmidecode, kmod }:
6 version = "unstable-2023-01-30";
8 src = fetchFromGitHub {
11 rev = "8fdc1d40e30f65737fef6c3ddcd1d2cd769f6277";
12 hash = "sha256-jZGRrZ1sa4x0/TBJ5GsNVuWakmPNOU+oiOoXdhARunk=";
15 # Hard-code program paths instead of using PATH lookups. Also, labels.d and
16 # mainboard are for user-configurable data, so do not look for them in Nix
18 dmidecodeProgram = lib.getExe' dmidecode "dmidecode";
19 modprobeProgram = lib.getExe' kmod "modprobe";
21 substituteInPlace src/util/edac-ctl.in \
22 --replace-fail 'find_prog ("dmidecode")' "\"$dmidecodeProgram\"" \
23 --replace-fail 'find_prog ("modprobe") or exit (1)' "\"$modprobeProgram\"" \
24 --replace-fail '"$sysconfdir/edac/labels.d"' '"/etc/edac/labels.d"' \
25 --replace-fail '"$sysconfdir/edac/mainboard"' '"/etc/edac/mainboard"'
28 # NB edac-utils needs Perl for configure script, but also edac-ctl program is
29 # a Perl script. Perl from buildInputs is used by patchShebangsAuto in
30 # fixupPhase to update the hash bang line.
32 nativeBuildInputs = [ perl ];
33 buildInputs = [ perl sysfsutils ];
36 "sbindir=${placeholder "out"}/bin"
39 # SysV init script is not relevant.
41 rm -r "$out"/etc/init.d
45 homepage = "https://github.com/grondo/edac-utils";
46 description = "Handles the reporting of hardware-related memory errors";
47 license = licenses.gpl2Plus;
48 platforms = platforms.linux;