2021-02-02 01:47:36 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, libyamlcpp
|
|
|
|
, pkg-config
|
|
|
|
, procps
|
|
|
|
, coreutils
|
|
|
|
, smartSupport ? false, libatasmart
|
|
|
|
}:
|
2013-04-05 23:34:50 +01:00
|
|
|
|
2015-12-27 20:21:43 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "thinkfan";
|
2020-12-07 14:38:22 +00:00
|
|
|
version = "1.2.1";
|
2013-04-05 23:34:50 +01:00
|
|
|
|
2019-02-16 10:51:59 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "vmatare";
|
|
|
|
repo = "thinkfan";
|
2019-09-24 20:00:03 +01:00
|
|
|
rev = version;
|
2020-12-07 14:38:22 +00:00
|
|
|
sha256 = "18vgm5w5pjnpipa34j4x87q10695w2jnqwvc2f027afy7mnzw7kz";
|
2013-04-05 23:34:50 +01:00
|
|
|
};
|
2015-12-27 20:21:43 +00:00
|
|
|
|
2021-02-03 10:37:45 +00:00
|
|
|
postPatch = ''
|
|
|
|
# fix hardcoded install path
|
|
|
|
substituteInPlace CMakeLists.txt --replace /etc $out/etc
|
|
|
|
|
|
|
|
# fix command paths in unit files
|
|
|
|
for unit in rcscripts/systemd/*; do
|
|
|
|
substituteInPlace "$unit" \
|
|
|
|
--replace /bin/kill ${procps}/bin/kill \
|
|
|
|
--replace /usr/bin/pkill ${procps}/bin/pkill \
|
|
|
|
--replace /usr/bin/sleep ${coreutils}/bin/sleep
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2019-09-24 23:33:22 +01:00
|
|
|
cmakeFlags = [
|
2019-09-24 20:00:03 +01:00
|
|
|
"-DCMAKE_INSTALL_DOCDIR=share/doc/${pname}"
|
2019-02-16 10:51:59 +00:00
|
|
|
"-DUSE_NVML=OFF"
|
2021-02-03 10:37:45 +00:00
|
|
|
# force install unit files
|
|
|
|
"-DSYSTEMD_FOUND=ON"
|
2021-01-15 09:19:50 +00:00
|
|
|
] ++ lib.optional smartSupport "-DUSE_ATASMART=ON";
|
2015-12-27 20:21:43 +00:00
|
|
|
|
2021-01-17 09:17:16 +00:00
|
|
|
nativeBuildInputs = [ cmake pkg-config ];
|
2019-02-16 10:51:59 +00:00
|
|
|
|
2021-01-15 09:19:50 +00:00
|
|
|
buildInputs = [ libyamlcpp ] ++ lib.optional smartSupport libatasmart;
|
2019-02-03 21:34:41 +00:00
|
|
|
|
2021-02-02 01:47:36 +00:00
|
|
|
meta = {
|
|
|
|
description = "A simple, lightweight fan control program";
|
|
|
|
longDescription = ''
|
|
|
|
Thinkfan is a minimalist fan control program. Originally designed
|
|
|
|
specifically for IBM/Lenovo Thinkpads, it now supports any kind of
|
|
|
|
system via the sysfs hwmon interface (/sys/class/hwmon).
|
|
|
|
'';
|
|
|
|
license = lib.licenses.gpl3Plus;
|
2019-09-24 23:33:22 +01:00
|
|
|
homepage = "https://github.com/vmatare/thinkfan";
|
2021-02-03 10:29:34 +00:00
|
|
|
maintainers = with lib.maintainers; [ domenkozar rnhmjoj ];
|
2021-02-02 01:47:36 +00:00
|
|
|
platforms = lib.platforms.linux;
|
2013-04-05 23:34:50 +01:00
|
|
|
};
|
|
|
|
}
|