nixpkgs/pkgs/by-name/ed/edac-utils/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

51 lines
1.6 KiB
Nix

{ lib, stdenv, fetchFromGitHub, perl
, sysfsutils, dmidecode, kmod }:
stdenv.mkDerivation {
pname = "edac-utils";
version = "unstable-2023-01-30";
src = fetchFromGitHub {
owner = "grondo";
repo = "edac-utils";
rev = "8fdc1d40e30f65737fef6c3ddcd1d2cd769f6277";
hash = "sha256-jZGRrZ1sa4x0/TBJ5GsNVuWakmPNOU+oiOoXdhARunk=";
};
# 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"'
'';
# 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 ];
installFlags = [
"sbindir=${placeholder "out"}/bin"
];
# SysV init script is not relevant.
postInstall = ''
rm -r "$out"/etc/init.d
'';
meta = with lib; {
homepage = "https://github.com/grondo/edac-utils";
description = "Handles the reporting of hardware-related memory errors";
license = licenses.gpl2Plus;
platforms = platforms.linux;
};
}