summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/hd/hddtemp/package.nix
blob: 7f758b018d260ec7ed06be4564d27fb03d013c2f (plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{
  lib,
  stdenv,
  fetchurl,
  nixosTests,
}:
let
  db = fetchurl {
    url = "mirror://savannah/hddtemp/hddtemp.db";
    sha256 = "1fr6qgns6qv7cr40lic5yqwkkc7yjmmgx8j0z6d93csg3smzhhya";
  };

in
stdenv.mkDerivation (finalAttrs: {
  pname = "hddtemp";
  version = "0.3-beta15";

  src = fetchurl {
    url = "mirror://savannah/hddtemp/hddtemp-${finalAttrs.version}.tar.bz2";
    sha256 = "sha256-YYVBWEBUCT1TvootnoHJcXTzDwCvkcuHAKl+RC1571s=";
  };

  # from Gentoo
  patches = [
    ./byteswap.patch
    ./dontwake.patch
    ./execinfo.patch
    ./satacmds.patch
  ];

  configureFlags = [
    "--with-db-path=${placeholder "out"}/share/hddtemp/hddtemp.db"
  ];

  env = lib.optionalAttrs stdenv.cc.isGNU {
    NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration";
  };

  postInstall = ''
    install -Dm444 ${db} $out/share/hddtemp/hddtemp.db
  '';

  enableParallelBuilding = true;

  strictDeps = true;
  __structuredAttrs = true;

  passthru.tests.nixos = nixosTests.hddtemp;

  meta = {
    description = "Tool for displaying hard disk temperature";
    homepage = "https://savannah.nongnu.org/projects/hddtemp/";
    license = lib.licenses.gpl2Plus;
    maintainers = with lib.maintainers; [ peterhoeg ];
    platforms = lib.platforms.linux;
    mainProgram = "hddtemp";
  };
})