nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 77 lines 2.0 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 cmake, 6 lm_sensors, 7 yaml-cpp, 8 pkg-config, 9 procps, 10 coreutils, 11 smartSupport ? false, 12 libatasmart, 13}: 14 15stdenv.mkDerivation (finalAttrs: { 16 pname = "thinkfan"; 17 version = "2.0.0"; 18 19 src = fetchFromGitHub { 20 owner = "vmatare"; 21 repo = "thinkfan"; 22 tag = finalAttrs.version; 23 hash = "sha256-QqDWPOXy8E+TY5t0fFRAS8BGA7ZH90xecv5UsFfDssk="; 24 }; 25 26 postPatch = # fix hardcoded install path 27 '' 28 substituteInPlace CMakeLists.txt \ 29 --replace-fail "/etc" "$out/etc" 30 '' 31 # fix command paths in unit files 32 + '' 33 substituteInPlace rcscripts/systemd/thinkfan-sleep.service \ 34 --replace-fail "/usr/bin/pkill" "${lib.getExe' procps "pkill"}" 35 substituteInPlace rcscripts/systemd/thinkfan-sleep.service \ 36 --replace-fail "ExecStart=sleep " "ExecStart=${lib.getExe' coreutils "sleep"} " 37 substituteInPlace rcscripts/systemd/thinkfan-wakeup.service \ 38 --replace-fail "/usr/bin/pkill" "${lib.getExe' procps "pkill"}" 39 substituteInPlace rcscripts/systemd/thinkfan.service.cmake \ 40 --replace-fail "/bin/kill" "${lib.getExe' procps "kill"}" 41 ''; 42 43 cmakeFlags = [ 44 "-DCMAKE_INSTALL_DOCDIR=share/doc/thinkfan" 45 "-DUSE_NVML=OFF" 46 # force install unit files 47 "-DSYSTEMD_FOUND=ON" 48 ] 49 ++ lib.optional smartSupport "-DUSE_ATASMART=ON"; 50 51 nativeBuildInputs = [ 52 cmake 53 pkg-config 54 ]; 55 56 buildInputs = [ 57 lm_sensors 58 yaml-cpp 59 ] 60 ++ lib.optional smartSupport libatasmart; 61 62 meta = { 63 description = "Simple, lightweight fan control program"; 64 longDescription = '' 65 Thinkfan is a minimalist fan control program. Originally designed 66 specifically for IBM/Lenovo Thinkpads, it now supports any kind of 67 system via the sysfs hwmon interface (/sys/class/hwmon). 68 ''; 69 license = lib.licenses.gpl3Plus; 70 homepage = "https://github.com/vmatare/thinkfan"; 71 maintainers = with lib.maintainers; [ 72 rnhmjoj 73 ]; 74 platforms = lib.platforms.linux; 75 mainProgram = "thinkfan"; 76 }; 77})