1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 fetchpatch,
6 ncurses,
7 withGui ? false,
8 qtbase,
9}:
10
11stdenv.mkDerivation rec {
12 pname = "i7z";
13 version = "0.27.4";
14
15 src = fetchFromGitHub {
16 owner = "DimitryAndric";
17 repo = "i7z";
18 rev = "v${version}";
19 sha256 = "00c4ng30ry88hcya4g1i9dngiqmz3cs31x7qh1a10nalxn1829xy";
20 };
21
22 buildInputs = [ ncurses ] ++ lib.optional withGui qtbase;
23
24 patches = [
25 (fetchpatch {
26 url = "https://salsa.debian.org/debian/i7z/raw/ad1359764ee7a860a02e0c972f40339058fa9369/debian/patches/fix-insecure-tempfile.patch";
27 sha256 = "0ifg06xjw14y4fnzzgkhqm4sv9mcdzgi8m2wffq9z8b1r0znya3s";
28 })
29 (fetchpatch {
30 url = "https://salsa.debian.org/debian/i7z/raw/ad1359764ee7a860a02e0c972f40339058fa9369/debian/patches/nehalem.patch";
31 sha256 = "1ys6sgm01jkqb6d4y7qc3h89dzph8jjjcfya5c5jcm7dkxlzjq8a";
32 })
33 (fetchpatch {
34 url = "https://salsa.debian.org/debian/i7z/raw/ad1359764ee7a860a02e0c972f40339058fa9369/debian/patches/hyphen-used-as-minus-sign.patch";
35 sha256 = "1ji2qvdyq0594cpqz0dlsfggvw3rm63sygh0jxvwjgxpnhykhg1p";
36 })
37 ./qt5.patch
38 ];
39
40 enableParallelBuilding = true;
41
42 postBuild = lib.optionalString withGui ''
43 cd GUI
44 qmake
45 make clean
46 make
47 cd ..
48 '';
49
50 makeFlags = [ "prefix=${placeholder "out"}" ];
51
52 postInstall = lib.optionalString withGui ''
53 install -Dm755 GUI/i7z_GUI $out/bin/i7z-gui
54 '';
55
56 meta = with lib; {
57 description = "Better i7 (and now i3, i5) reporting tool for Linux";
58 mainProgram = "i7z";
59 homepage = "https://github.com/DimitryAndric/i7z";
60 license = licenses.gpl2Only;
61 # broken on ARM
62 platforms = [ "x86_64-linux" ];
63 };
64}