depot/third_party/nixpkgs/pkgs/tools/system/thinkfan/default.nix
Default email 841d9c7fc1 Project import generated by Copybara.
GitOrigin-RevId: 3a8d7958a610cd3fec3a6f424480f91a1b259185
2021-06-29 00:13:55 +01:00

59 lines
1.6 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, cmake
, libyamlcpp
, pkg-config
, procps
, coreutils
, smartSupport ? false, libatasmart
}:
stdenv.mkDerivation rec {
pname = "thinkfan";
version = "1.2.2";
src = fetchFromGitHub {
owner = "vmatare";
repo = "thinkfan";
rev = version;
sha256 = "01l1pnj1cgy3dwgyys2s5iqzyv6kk47vlpy09qjafk8py21ijik3";
};
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
'';
cmakeFlags = [
"-DCMAKE_INSTALL_DOCDIR=share/doc/${pname}"
"-DUSE_NVML=OFF"
# force install unit files
"-DSYSTEMD_FOUND=ON"
] ++ lib.optional smartSupport "-DUSE_ATASMART=ON";
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [ libyamlcpp ] ++ lib.optional smartSupport libatasmart;
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;
homepage = "https://github.com/vmatare/thinkfan";
maintainers = with lib.maintainers; [ domenkozar rnhmjoj ];
platforms = lib.platforms.linux;
};
}