···18181919 vendorHash = "sha256-ad0e/cxbcU/KfPDOdD46KdCcvns83dgGDAyLLQiGyiA=";
20202121+ buildInputs = [ lm_sensors ];
2222+2123 postConfigure = ''
2224 substituteInPlace vendor/github.com/md14454/gosensors/gosensors.go \
2323- --replace-fail '"/etc/sensors3.conf"' '"${lm_sensors}/etc/sensors3.conf"'
2525+ --replace-fail '"/etc/sensors3.conf"' '"${lib.getLib lm_sensors}/etc/sensors3.conf"'
24262527 # Uses /usr/bin/echo, and even if we patch that, it refuses to execute any
2628 # binary without being able to confirm that it's owned by root, which isn't
2729 # possible under the sandbox.
2830 rm internal/fans/cmd_test.go
2931 '';
3030-3131- CGO_CFLAGS = "-I ${lm_sensors}/include";
3232- CGO_LDFLAGS = "-L ${lm_sensors}/lib";
33323433 meta = with lib; {
3534 description = "Simple daemon providing dynamic fan speed control based on temperature sensors";
+47-17
pkgs/by-name/lm/lm_sensors/package.nix
···22 lib,
33 stdenv,
44 fetchFromGitHub,
55+ fetchpatch,
56 bash,
67 bison,
78 flex,
89 which,
910 perl,
1111+ rrdtool,
1012 sensord ? false,
1111- rrdtool ? null,
1213}:
13141414-assert sensord -> rrdtool != null;
1515+let
1616+ version = "3.6.0";
1717+ tag = lib.replaceStrings [ "." ] [ "-" ] version;
1818+in
15191616-stdenv.mkDerivation rec {
2020+stdenv.mkDerivation {
1721 pname = "lm-sensors";
1818- version = "3.6.0";
1919- dashedVersion = lib.replaceStrings [ "." ] [ "-" ] version;
2222+ inherit version;
20232124 src = fetchFromGitHub {
2225 owner = "lm-sensors";
2326 repo = "lm-sensors";
2424- rev = "V${dashedVersion}";
2727+ inherit tag;
2528 hash = "sha256-9lfHCcODlS7sZMjQhK0yQcCBEoGyZOChx/oM0CU37sY=";
2629 };
3030+3131+ patches = [
3232+ # Fix compile failure on GCC 14 with `sensord` enabled.
3333+ # From: https://github.com/lm-sensors/lm-sensors/pull/483
3434+ (fetchpatch {
3535+ url = "https://github.com/lm-sensors/lm-sensors/pull/483/commits/7a6170f07d05cc6601b4668f211e9389f2e75286.patch";
3636+ hash = "sha256-Q49quv3eXeMvY3jgZFs/F7Rljbq4YyehIDIlsgmloBQ=";
3737+ })
3838+ ];
3939+4040+ outputs = [
4141+ "bin"
4242+ "out"
4343+ "dev"
4444+ "man"
4545+ "doc"
4646+ ];
27472848 # Upstream build system have knob to enable and disable building of static
2949 # library, shared library is built unconditionally.
3050 postPatch = lib.optionalString stdenv.hostPlatform.isStatic ''
3151 sed -i 'lib/Module.mk' -e '/LIBTARGETS :=/,+1d; /-m 755/ d'
3232- substituteInPlace prog/sensors/Module.mk --replace 'lib/$(LIBSHBASENAME)' ""
5252+ substituteInPlace prog/sensors/Module.mk \
5353+ --replace-fail 'lib/$(LIBSHBASENAME)' ""
3354 '';
34553556 nativeBuildInputs = [
···3758 flex
3859 which
3960 ];
6161+4062 # bash is required for correctly replacing the shebangs in all tools for cross-compilation.
4163 buildInputs = [
4264 bash
···45674668 makeFlags = [
4769 "PREFIX=${placeholder "out"}"
7070+ "BINDIR=${placeholder "bin"}/bin"
7171+ "SBINDIR=${placeholder "bin"}/bin"
7272+ "INCLUDEDIR=${placeholder "dev"}/include"
7373+ "MANDIR=${placeholder "man"}/share/man"
7474+ # This is a dependency of the library.
7575+ "ETCDIR=${placeholder "out"}/etc"
7676+4877 "CC=${stdenv.cc.targetPrefix}cc"
4978 "AR=${stdenv.cc.targetPrefix}ar"
5079 ] ++ lib.optional sensord "PROG_EXTRA=sensord";
51805252- installFlags = [
5353- "ETCDIR=${placeholder "out"}/etc"
5454- ];
8181+ enableParallelBuilding = true;
55825683 # Making regexp to patch-out installing of .so symlinks from Makefile is
5784 # complicated, it is easier to remove them post-install.
5885 postInstall =
5986 ''
6060- mkdir -p $out/share/doc/${pname}
6161- cp -r configs doc/* $out/share/doc/${pname}
8787+ mkdir -p $doc/share/doc/lm_sensors
8888+ cp -r configs doc/* $doc/share/doc/lm_sensors
6289 ''
6390 + lib.optionalString stdenv.hostPlatform.isStatic ''
6491 rm $out/lib/*.so*
6592 '';
66936767- meta = with lib; {
9494+ meta = {
6895 homepage = "https://hwmon.wiki.kernel.org/lm_sensors";
6969- changelog = "https://raw.githubusercontent.com/lm-sensors/lm-sensors/V${dashedVersion}/CHANGES";
9696+ changelog = "https://raw.githubusercontent.com/lm-sensors/lm-sensors/${tag}/CHANGES";
7097 description = "Tools for reading hardware sensors";
7171- license = with licenses; [
9898+ license = with lib.licenses; [
7299 lgpl21Plus
73100 gpl2Plus
74101 ];
7575- maintainers = with maintainers; [ pmy ];
7676- platforms = platforms.linux;
102102+ maintainers = with lib.maintainers; [
103103+ pmy
104104+ oxalica
105105+ ];
106106+ platforms = lib.platforms.linux;
77107 mainProgram = "sensors";
78108 };
79109}