Files
nixpkgs/pkgs/by-name/lm/lm_sensors/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

98 lines
2.2 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
bash,
bison,
flex,
which,
perl,
rrdtool,
sensord ? false,
}:
let
version = "3.6.2";
tag = "V" + lib.replaceStrings [ "." ] [ "-" ] version;
in
stdenv.mkDerivation {
pname = "lm-sensors";
inherit version;
src = fetchFromGitHub {
owner = "hramrach"; # openSUSE fork used by openSUSE and Gentoo
repo = "lm-sensors";
inherit tag;
hash = "sha256-EmS9H3TQac6bHs2G8t1C2cQNAjN13zPoKDysny6aTFw=";
};
outputs = [
"bin"
"out"
"dev"
"man"
"doc"
];
postPatch =
# This allows sensors to continue reading the sensors3.conf as provided by
# upstream and also look for config fragments in /etc/sensors.d
''
substituteInPlace lib/init.c \
--replace-fail 'ETCDIR "/sensors.d"' '"/etc/sensors.d"'
'';
nativeBuildInputs = [
bison
flex
which
];
# bash is required for correctly replacing the shebangs in all tools for cross-compilation.
buildInputs = [
bash
perl
]
++ lib.optional sensord rrdtool;
makeFlags = [
"PREFIX=${placeholder "out"}"
"BINDIR=${placeholder "bin"}/bin"
"SBINDIR=${placeholder "bin"}/bin"
"INCLUDEDIR=${placeholder "dev"}/include"
"MANDIR=${placeholder "man"}/share/man"
# This is a dependency of the library.
"ETCDIR=${placeholder "out"}/etc"
"BUILD_SHARED_LIB=${if stdenv.hostPlatform.isStatic then "0" else "1"}"
"BUILD_STATIC_LIB=${if stdenv.hostPlatform.isStatic then "1" else "0"}"
"CC=${stdenv.cc.targetPrefix}cc"
"AR=${stdenv.cc.targetPrefix}ar"
]
++ lib.optional sensord "PROG_EXTRA=sensord";
enableParallelBuilding = true;
postInstall = ''
mkdir -p $doc/share/doc/lm_sensors
cp -r configs doc/* $doc/share/doc/lm_sensors
'';
meta = {
homepage = "https://hwmon.wiki.kernel.org/lm_sensors";
changelog = "https://raw.githubusercontent.com/hramrach/lm-sensors/${tag}/CHANGES";
description = "Tools for reading hardware sensors - maintained fork";
license = with lib.licenses; [
lgpl21Plus
gpl2Plus
];
maintainers = with lib.maintainers; [
pmy
oxalica
];
platforms = lib.platforms.linux;
mainProgram = "sensors";
};
}