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