about summary refs log tree commit diff
path: root/pkgs/os-specific/linux/edac-utils/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/os-specific/linux/edac-utils/default.nix')
-rw-r--r--pkgs/os-specific/linux/edac-utils/default.nix38
1 files changed, 25 insertions, 13 deletions
diff --git a/pkgs/os-specific/linux/edac-utils/default.nix b/pkgs/os-specific/linux/edac-utils/default.nix
index b23e0d34401a9..db106c14b434a 100644
--- a/pkgs/os-specific/linux/edac-utils/default.nix
+++ b/pkgs/os-specific/linux/edac-utils/default.nix
@@ -1,32 +1,44 @@
-{ lib, stdenv, fetchFromGitHub, perl, makeWrapper
+{ lib, stdenv, fetchFromGitHub, perl
 , sysfsutils, dmidecode, kmod }:
 
 stdenv.mkDerivation {
   pname = "edac-utils";
-  version = "unstable-2015-01-07";
+  version = "unstable-2023-01-30";
 
   src = fetchFromGitHub {
     owner = "grondo";
     repo = "edac-utils";
-    rev = "f9aa96205f610de39a79ff43c7478b7ef02e3138";
-    sha256 = "1dmfqb15ffldl5zirbmwiqzpxbcc2ny9rpfvxcfvpmh5b69knvdg";
+    rev = "8fdc1d40e30f65737fef6c3ddcd1d2cd769f6277";
+    hash = "sha256-jZGRrZ1sa4x0/TBJ5GsNVuWakmPNOU+oiOoXdhARunk=";
   };
 
-  nativeBuildInputs = [ perl makeWrapper ];
-  buildInputs = [ sysfsutils ];
+  # 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"'
+  '';
 
-  configureFlags = [
-    "--sysconfdir=/etc"
-    "--localstatedir=/var"
-  ];
+  # 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 = [
-    "sysconfdir=\${out}/etc"
+    "sbindir=${placeholder "out"}/bin"
   ];
 
+  # SysV init script is not relevant.
   postInstall = ''
-    wrapProgram "$out/sbin/edac-ctl" \
-      --set PATH ${lib.makeBinPath [ dmidecode kmod ]}
+    rm -r "$out"/etc/init.d
   '';
 
   meta = with lib; {