about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/zc/zcfan/package.nix
blob: 7fd6eea7a5b2906ab39a82c1ef9a1da87a99a77e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{ lib
, stdenv
, fetchFromGitHub
}:

# Testing this requires a Thinkpad or the presence of /proc/acpi/ibm/fan
stdenv.mkDerivation (finalAttrs: {
  pname = "zcfan";
  version = "1.3.0";

  src = fetchFromGitHub {
    owner = "cdown";
    repo = "zcfan";
    rev = finalAttrs.version;
    hash = "sha256-zpYQEHXt8LBNX+luM4YxP0dKH+hb2c8Z0BEeGP09oZo=";
  };

  postPatch = ''
    substituteInPlace Makefile \
      --replace "/usr/local" $out
  '';

  doInstallCheck = true;

  installCheckPhase = ''
    runHook preInstallCheck

    $out/bin/${finalAttrs.pname} -h

    runHook postInstallCheck
  '';

  meta = with lib; {
    description = "A zero-configuration fan daemon for ThinkPads";
    mainProgram = "zcfan";
    homepage = "https://github.com/cdown/zcfan";
    changelog = "https://github.com/cdown/zcfan/tags/${finalAttrs.version}";
    license = licenses.mit;
    maintainers = with maintainers; [ kashw2 ];
    platforms = platforms.linux;
  };
})