at 23.11-beta 111 lines 3.7 kB view raw
1{ lib, stdenv, fetchFromGitHub 2, autoreconfHook 3, glibcLocales, kmod, coreutils, perl 4, dmidecode, hwdata, sqlite 5, nixosTests 6}: 7 8stdenv.mkDerivation rec { 9 pname = "rasdaemon"; 10 version = "0.7.0"; 11 12 src = fetchFromGitHub { 13 owner = "mchehab"; 14 repo = "rasdaemon"; 15 rev = "v${version}"; 16 sha256 = "sha256-oLwR+bNgKceVgLTOLYiKHNUkRmLouaQshdp/8UJnfqg="; 17 }; 18 19 nativeBuildInputs = [ autoreconfHook ]; 20 21 buildInputs = [ 22 coreutils 23 glibcLocales 24 hwdata 25 kmod 26 sqlite 27 (perl.withPackages (ps: with ps; [ DBI DBDSQLite ])) 28 ] 29 ++ lib.optionals (!stdenv.isAarch64) [ dmidecode ]; 30 31 configureFlags = [ 32 "--sysconfdir=/etc" 33 "--localstatedir=/var" 34 "--with-sysconfdefdir=${placeholder "out"}/etc/sysconfig" 35 "--enable-sqlite3" 36 "--enable-aer" 37 "--enable-mce" 38 "--enable-extlog" 39 "--enable-non-standard" 40 "--enable-abrt-report" 41 "--enable-hisi-ns-decode" 42 "--enable-devlink" 43 "--enable-diskerror" 44 "--enable-memory-failure" 45 "--enable-memory-ce-pfa" 46 "--enable-amp-ns-decode" 47 ] 48 ++ lib.optionals (stdenv.isAarch64) [ "--enable-arm" ]; 49 50 # The installation attempts to create the following directories: 51 # /var/lib/rasdaemon 52 # location of the RAS event log generated by rasdaemon -r 53 # /etc/ras/dimm_labels.d 54 # location of the DIMM labels generated by ras-mc-ctl 55 # /etc/sysconfig/rasdaemon 56 # location of rasdaemon config file, currently only used for CE PFA config 57 58 # these are optional (for logging, DIMM label storage and user config) 59 # /var/lib/rasdaemon should be created by the NixOS module 60 # /etc/ras/dimm_labels.d should probably be generated, 61 # from user supplied content, in the NixOS module 62 # /etc/sysconfig/rasdaemon should be generated if there is user supplied content 63 # and default to $out/etc/sysconfig/rasdaemon which should hold the supplied default 64 65 # therefore, stripping these from the generated Makefile 66 # (needed in the config flags because those set where the tools look for these) 67 68# easy way out, ends up installing /nix/store/...rasdaemon/bin in $out 69 70 postConfigure = '' 71 substituteInPlace Makefile \ 72 --replace '"$(DESTDIR)/etc/ras/dimm_labels.d"' '"$(prefix)/etc/ras/dimm_labels.d"' 73 ''; 74 75 outputs = [ "out" "dev" "man" "inject" ]; 76 77 postInstall = '' 78 install -Dm 0755 contrib/edac-fake-inject $inject/bin/edac-fake-inject 79 install -Dm 0755 contrib/edac-tests $inject/bin/edac-tests 80 ''; 81 82 postFixup = '' 83 # Fix dmidecode and modprobe paths 84 substituteInPlace $out/bin/ras-mc-ctl \ 85 --replace 'find_prog ("modprobe") or exit (1)' '"${kmod}/bin/modprobe"' 86 '' 87 + lib.optionalString (!stdenv.isAarch64) '' 88 substituteInPlace $out/bin/ras-mc-ctl \ 89 --replace 'find_prog ("dmidecode")' '"${dmidecode}/bin/dmidecode"' 90 ''; 91 92 passthru.tests = nixosTests.rasdaemon; 93 94 meta = with lib; { 95 description = '' 96 A Reliability, Availability and Serviceability (RAS) logging tool using EDAC kernel tracing events 97 ''; 98 longDescription = '' 99 Rasdaemon is a RAS (Reliability, Availability and Serviceability) logging 100 tool. It records memory errors, using the EDAC tracing events. EDAC is a 101 Linux kernel subsystem with handles detection of ECC errors from memory 102 controllers for most chipsets on i386 and x86_64 architectures. EDAC 103 drivers for other architectures like arm also exists. 104 ''; 105 homepage = "https://github.com/mchehab/rasdaemon"; 106 license = licenses.gpl2Plus; 107 platforms = platforms.linux; 108 changelog = "https://github.com/mchehab/rasdaemon/blob/v${version}/ChangeLog"; 109 maintainers = with maintainers; [ evils ]; 110 }; 111}