nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 autoreconfHook,
3 fetchFromGitHub,
4 lib,
5 libtraceevent,
6 nix-update-script,
7 nixosTests,
8 pciutils,
9 perl,
10 pkg-config,
11 sqlite,
12 stdenv,
13 # Options
14 enableDmidecode ? stdenv.hostPlatform.isx86_64,
15 dmidecode,
16}:
17
18stdenv.mkDerivation (finalAttrs: {
19 pname = "rasdaemon";
20 version = "0.8.4";
21
22 src = fetchFromGitHub {
23 owner = "mchehab";
24 repo = "rasdaemon";
25 tag = "v${finalAttrs.version}";
26 hash = "sha256-rk4CZrWQRe2wsx8/eXP0BIeaU/Gxmcb+Kry5F8t4YKQ=";
27 };
28
29 strictDeps = true;
30
31 enableParallelBuilding = true;
32
33 nativeBuildInputs = [
34 autoreconfHook
35 pkg-config
36 ];
37
38 buildInputs = [
39 libtraceevent
40 (perl.withPackages (
41 ps: with ps; [
42 DBDSQLite
43 ]
44 ))
45 pciutils
46 sqlite
47 ]
48 ++ lib.optionals enableDmidecode [
49 dmidecode
50 ];
51
52 configureFlags = [
53 "--sysconfdir=/etc"
54 "--localstatedir=/var"
55 "--enable-all"
56 ];
57
58 # The installation attempts to create the following directories:
59 # /var/lib/rasdaemon
60 # location of the RAS event log generated by rasdaemon -r
61 # /etc/ras/dimm_labels.d
62 # location of the DIMM labels generated by ras-mc-ctl
63 # /etc/sysconfig/rasdaemon
64 # location of rasdaemon config file, currently only used for CE PFA config
65
66 # these are optional (for logging, DIMM label storage and user config)
67 # /var/lib/rasdaemon should be created by the NixOS module
68 # /etc/ras/dimm_labels.d should probably be generated,
69 # from user supplied content, in the NixOS module
70 # /etc/sysconfig/rasdaemon should be generated if there is user supplied content
71 # and default to $out/etc/sysconfig/rasdaemon which should hold the supplied default
72
73 # therefore, stripping these from the generated Makefile
74 # (needed in the config flags because those set where the tools look for these)
75
76 # easy way out, ends up installing /nix/store/...rasdaemon/bin in $out
77
78 postPatch = ''
79 patchShebangs contrib/
80 '';
81
82 preConfigure = ''
83 substituteInPlace Makefile.am \
84 --replace-fail '"$(DESTDIR)@sysconfdir@/ras/dimm_labels.d"' '"$(prefix)@sysconfdir@/ras/dimm_labels.d"' \
85 --replace-fail '"$(DESTDIR)@SYSCONFDEFDIR@/rasdaemon"' '"$(prefix)@SYSCONFDEFDIR@/rasdaemon"' \
86 --replace-fail '"$(DESTDIR)@sysconfdir@/ras/triggers' '"$(prefix)@sysconfdir@/ras/triggers'
87 '';
88
89 outputs = [
90 "out"
91 "dev"
92 "man"
93 "inject"
94 ];
95
96 postInstall = ''
97 install -Dm 0755 contrib/edac-fake-inject $inject/bin/edac-fake-inject
98 install -Dm 0755 contrib/edac-tests $inject/bin/edac-tests
99 '';
100
101 postFixup = lib.optionalString enableDmidecode ''
102 substituteInPlace $out/bin/ras-mc-ctl \
103 --replace-fail 'find_prog ("dmidecode")' '"${dmidecode}/bin/dmidecode"'
104 '';
105
106 passthru.tests = nixosTests.rasdaemon;
107
108 passthru.updateScript = nix-update-script { };
109
110 meta = {
111 description = ''
112 A Reliability, Availability and Serviceability (RAS) logging tool using EDAC kernel tracing events
113 '';
114 longDescription = ''
115 Rasdaemon is a RAS (Reliability, Availability and Serviceability) logging
116 tool. It records memory errors, using the EDAC tracing events. EDAC is a
117 Linux kernel subsystem with handles detection of ECC errors from memory
118 controllers for most chipsets on i386 and x86_64 architectures. EDAC
119 drivers for other architectures like arm also exists.
120 '';
121 homepage = "https://github.com/mchehab/rasdaemon";
122 license = lib.licenses.gpl2Plus;
123 platforms = lib.platforms.linux;
124 changelog = "${finalAttrs.meta.homepage}/releases/tag/v${finalAttrs.version}";
125 maintainers = [ ];
126 };
127})