2021-02-13 14:23:35 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, libyamlcpp
|
|
|
|
, pkg-config
|
|
|
|
, procps
|
|
|
|
, coreutils
|
|
|
|
, smartSupport ? false, libatasmart
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "thinkfan";
|
2021-06-28 23:13:55 +00:00
|
|
|
version = "1.2.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "vmatare";
|
|
|
|
repo = "thinkfan";
|
|
|
|
rev = version;
|
2021-06-28 23:13:55 +00:00
|
|
|
sha256 = "01l1pnj1cgy3dwgyys2s5iqzyv6kk47vlpy09qjafk8py21ijik3";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-02-13 14:23:35 +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
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DCMAKE_INSTALL_DOCDIR=share/doc/${pname}"
|
|
|
|
"-DUSE_NVML=OFF"
|
2021-02-13 14:23:35 +00:00
|
|
|
# force install unit files
|
|
|
|
"-DSYSTEMD_FOUND=ON"
|
2021-01-15 22:18:51 +00:00
|
|
|
] ++ lib.optional smartSupport "-DUSE_ATASMART=ON";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ cmake pkg-config ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
buildInputs = [ libyamlcpp ] ++ lib.optional smartSupport libatasmart;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-13 14:23:35 +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;
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/vmatare/thinkfan";
|
2021-02-13 14:23:35 +00:00
|
|
|
maintainers = with lib.maintainers; [ domenkozar rnhmjoj ];
|
|
|
|
platforms = lib.platforms.linux;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|