about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/system/hardinfo/default.nix
blob: a2e342f85b74fbe6b15e97b0e7f6f6cd2baf1e6c (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
43
44
45
46
47
48
49
50
{ stdenv, fetchurl, which, pkgconfig, gtk2, pcre, glib, libxml2
, libsoup ? null
}:

stdenv.mkDerivation rec {
  pname = "hardinfo";
  version = "0.5.1";

  src = fetchurl {
    url = "mirror://sourceforge/project/hardinfo.berlios/hardinfo-${version}.tar.bz2";
    sha256 = "0yhvfc5icam3i4mphlz0m9d9d2irjw8mbsxq203x59wjgh6nrpx0";
  };

  # Not adding 'hostname' command, the build shouldn't depend on what the build
  # host is called.
  nativeBuildInputs = [ pkgconfig ];
  buildInputs = [ which gtk2 pcre glib libxml2 libsoup ];

  # Fixes '#error You must compile this program without "-O"'
  hardeningDisable = [ "all" ];

  # Ignore undefined references to a bunch of libsoup symbols
  NIX_LDFLAGS = "--unresolved-symbol=ignore-all";

  preConfigure = ''
    patchShebangs configure

    # -std=gnu89 fixes build error, copied from
    # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=757525
    sed -i -e "s/^CFLAGS = \(.*\)/CFLAGS = \1 -std=gnu89/" Makefile.in

    substituteInPlace ./arch/linux/common/modules.h --replace /sbin/modinfo modinfo
    substituteInPlace ./arch/linux/common/os.h --replace /lib/libc.so.6 ${stdenv.glibc.out}/lib/libc.so.6
  '';

  # Makefile supports DESTDIR but not PREFIX (it hardcodes $DESTDIR/usr/).
  installFlags = [ "DESTDIR=$(out)" ];
  postInstall = ''
    mv "$out/usr/"* "$out"
    rmdir "$out/usr"
  '';

  meta = with stdenv.lib; {
    homepage = http://hardinfo.org/;
    description = "Display information about your hardware and operating system";
    license = licenses.gpl2;
    maintainers = with maintainers; [ bjornfor ];
    platforms = platforms.linux;
  };
}