nixpkgs/pkgs/by-name/th/thinkfan/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

61 lines
1.6 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, cmake
, yaml-cpp
, pkg-config
, procps
, coreutils
, smartSupport ? false, libatasmart
}:
stdenv.mkDerivation rec {
pname = "thinkfan";
version = "1.3.1";
src = fetchFromGitHub {
owner = "vmatare";
repo = "thinkfan";
rev = version;
sha256 = "sha256-aREZv+t4QhtfLKOMrneLiRxgnu0fzB8UV8dvr1dnhx4=";
};
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 = [ yaml-cpp ] ++ lib.optional smartSupport libatasmart;
meta = {
description = "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;
mainProgram = "thinkfan";
};
}