13 assert sensord -> rrdtool != null;
15 stdenv.mkDerivation rec {
18 dashedVersion = lib.replaceStrings [ "." ] [ "-" ] version;
20 src = fetchFromGitHub {
23 rev = "V${dashedVersion}";
24 hash = "sha256-9lfHCcODlS7sZMjQhK0yQcCBEoGyZOChx/oM0CU37sY=";
27 # Upstream build system have knob to enable and disable building of static
28 # library, shared library is built unconditionally.
29 postPatch = lib.optionalString stdenv.hostPlatform.isStatic ''
30 sed -i 'lib/Module.mk' -e '/LIBTARGETS :=/,+1d; /-m 755/ d'
31 substituteInPlace prog/sensors/Module.mk --replace 'lib/$(LIBSHBASENAME)' ""
34 nativeBuildInputs = [ bison flex which ];
35 # bash is required for correctly replacing the shebangs in all tools for cross-compilation.
36 buildInputs = [ bash perl ]
37 ++ lib.optional sensord rrdtool;
40 "PREFIX=${placeholder "out"}"
41 "CC=${stdenv.cc.targetPrefix}cc"
42 "AR=${stdenv.cc.targetPrefix}ar"
43 ] ++ lib.optional sensord "PROG_EXTRA=sensord";
46 "ETCDIR=${placeholder "out"}/etc"
49 # Making regexp to patch-out installing of .so symlinks from Makefile is
50 # complicated, it is easier to remove them post-install.
52 mkdir -p $out/share/doc/${pname}
53 cp -r configs doc/* $out/share/doc/${pname}
54 '' + lib.optionalString stdenv.hostPlatform.isStatic ''
59 homepage = "https://hwmon.wiki.kernel.org/lm_sensors";
60 changelog = "https://raw.githubusercontent.com/lm-sensors/lm-sensors/V${dashedVersion}/CHANGES";
61 description = "Tools for reading hardware sensors";
62 license = with licenses; [ lgpl21Plus gpl2Plus ];
63 maintainers = with maintainers; [ pmy ];
64 platforms = platforms.linux;
65 mainProgram = "sensors";