Merge pull request #111624 from rnhmjoj/thinkfan

nixos/thinkfan: rewrite for 1.2 update
This commit is contained in:
Michele Guerini Rocco
2021-02-08 12:20:07 +01:00
committed by GitHub
3 changed files with 211 additions and 114 deletions
+35 -23
View File
@@ -1,5 +1,13 @@
{ lib, stdenv, fetchFromGitHub, cmake, libyamlcpp, pkg-config
, smartSupport ? false, libatasmart }:
{ lib
, stdenv
, fetchFromGitHub
, cmake
, libyamlcpp
, pkg-config
, procps
, coreutils
, smartSupport ? false, libatasmart
}:
stdenv.mkDerivation rec {
pname = "thinkfan";
@@ -12,36 +20,40 @@ stdenv.mkDerivation rec {
sha256 = "18vgm5w5pjnpipa34j4x87q10695w2jnqwvc2f027afy7mnzw7kz";
};
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;
installPhase = ''
runHook preInstall
install -Dm755 {.,$out/bin}/thinkfan
cd "$NIX_BUILD_TOP"; cd "$sourceRoot" # attempt to be a bit robust
install -Dm644 {.,$out/share/doc/thinkfan}/README.md
cp -R examples $out/share/doc/thinkfan
install -Dm644 {src,$out/share/man/man1}/thinkfan.1
runHook postInstall
'';
meta = with lib; {
description = "A minimalist fan control program";
longDescription = "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 = licenses.gpl3;
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 maintainers; [ domenkozar ];
platforms = platforms.linux;
maintainers = with lib.maintainers; [ domenkozar rnhmjoj ];
platforms = lib.platforms.linux;
};
}