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