1{ stdenv
2, lib
3, fetchFromGitHub
4, hwdata
5, gtk2
6, pkg-config
7, sqlite # compile GUI
8, withGUI ? false
9}:
10
11stdenv.mkDerivation rec {
12 pname = "lshw";
13 # Fix repology.org by not including the prefixed B, otherwise the `pname` attr
14 # gets filled as `lshw-B.XX.XX` in `nix-env --query --available --attr nixpkgs.lshw --meta`
15 # See https://github.com/NixOS/nix/pull/4463 for a definitive fix
16 version = "02.19";
17
18 src = fetchFromGitHub {
19 owner = "lyonel";
20 repo = pname;
21 rev = "B.${version}";
22 sha256 = "sha256-PzbNGc1pPiPLWWgTeWoNfAo+SsXgi1HcjnXfYXA9S0I=";
23 };
24
25 nativeBuildInputs = [ pkg-config ];
26
27 buildInputs = [ hwdata ]
28 ++ lib.optionals withGUI [ gtk2 sqlite ];
29
30 makeFlags = [
31 "PREFIX=$(out)"
32 "VERSION=${src.rev}"
33 ];
34
35 buildFlags = [ "all" ] ++ lib.optional withGUI "gui";
36
37 installTargets = [ "install" ] ++ lib.optional withGUI "install-gui";
38
39 enableParallelBuilding = true;
40
41 meta = with lib; {
42 homepage = "https://ezix.org/project/wiki/HardwareLiSter";
43 description = "Provide detailed information on the hardware configuration of the machine";
44 license = licenses.gpl2;
45 maintainers = with maintainers; [ thiagokokada ];
46 platforms = platforms.linux;
47 };
48}