nixpkgs/pkgs/tools/system/thinkfan/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

48 lines
1.4 KiB
Nix

{ lib, stdenv, fetchFromGitHub, cmake, libyamlcpp, pkgconfig
, smartSupport ? false, libatasmart }:
stdenv.mkDerivation rec {
pname = "thinkfan";
version = "1.2.1";
src = fetchFromGitHub {
owner = "vmatare";
repo = "thinkfan";
rev = version;
sha256 = "18vgm5w5pjnpipa34j4x87q10695w2jnqwvc2f027afy7mnzw7kz";
};
cmakeFlags = [
"-DCMAKE_INSTALL_DOCDIR=share/doc/${pname}"
"-DUSE_NVML=OFF"
] ++ stdenv.lib.optional smartSupport "-DUSE_ATASMART=ON";
nativeBuildInputs = [ cmake pkgconfig ];
buildInputs = [ libyamlcpp ] ++ stdenv.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;
homepage = "https://github.com/vmatare/thinkfan";
maintainers = with maintainers; [ domenkozar ];
platforms = platforms.linux;
};
}