2024-07-27 06:49:29 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, perl
|
2020-04-24 23:36:52 +00:00
|
|
|
, sysfsutils, dmidecode, kmod }:
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2021-09-26 12:46:18 +00:00
|
|
|
pname = "edac-utils";
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "unstable-2023-01-30";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "grondo";
|
|
|
|
repo = "edac-utils";
|
2024-07-27 06:49:29 +00:00
|
|
|
rev = "8fdc1d40e30f65737fef6c3ddcd1d2cd769f6277";
|
|
|
|
hash = "sha256-jZGRrZ1sa4x0/TBJ5GsNVuWakmPNOU+oiOoXdhARunk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
# Hard-code program paths instead of using PATH lookups. Also, labels.d and
|
|
|
|
# mainboard are for user-configurable data, so do not look for them in Nix
|
|
|
|
# store.
|
|
|
|
dmidecodeProgram = lib.getExe' dmidecode "dmidecode";
|
|
|
|
modprobeProgram = lib.getExe' kmod "modprobe";
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace src/util/edac-ctl.in \
|
|
|
|
--replace-fail 'find_prog ("dmidecode")' "\"$dmidecodeProgram\"" \
|
|
|
|
--replace-fail 'find_prog ("modprobe") or exit (1)' "\"$modprobeProgram\"" \
|
|
|
|
--replace-fail '"$sysconfdir/edac/labels.d"' '"/etc/edac/labels.d"' \
|
|
|
|
--replace-fail '"$sysconfdir/edac/mainboard"' '"/etc/edac/mainboard"'
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
# NB edac-utils needs Perl for configure script, but also edac-ctl program is
|
|
|
|
# a Perl script. Perl from buildInputs is used by patchShebangsAuto in
|
|
|
|
# fixupPhase to update the hash bang line.
|
|
|
|
strictDeps = true;
|
|
|
|
nativeBuildInputs = [ perl ];
|
|
|
|
buildInputs = [ perl sysfsutils ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installFlags = [
|
2024-07-27 06:49:29 +00:00
|
|
|
"sbindir=${placeholder "out"}/bin"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
# SysV init script is not relevant.
|
2020-04-24 23:36:52 +00:00
|
|
|
postInstall = ''
|
2024-07-27 06:49:29 +00:00
|
|
|
rm -r "$out"/etc/init.d
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/grondo/edac-utils";
|
|
|
|
description = "Handles the reporting of hardware-related memory errors";
|
2024-06-24 18:47:55 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|