nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 pkg-config,
6 zlib,
7 kmod,
8 which,
9 hwdata,
10 static ? stdenv.hostPlatform.isStatic,
11 gitUpdater,
12}:
13
14stdenv.mkDerivation rec {
15 pname = "pciutils";
16 version = "3.14.0"; # with release-date database
17
18 src = fetchFromGitHub {
19 owner = "pciutils";
20 repo = "pciutils";
21 rev = "v${version}";
22 hash = "sha256-8wSvu8BGzETD1RfwL6/DfSCZcmuj1I+zNH033f48qNQ=";
23 };
24
25 nativeBuildInputs = [ pkg-config ];
26 buildInputs = [
27 which
28 zlib
29 ]
30 ++ lib.optionals stdenv.hostPlatform.isLinux [ kmod ];
31
32 preConfigure = lib.optionalString (!stdenv.cc.isGNU) ''
33 substituteInPlace Makefile --replace 'CC=$(CROSS_COMPILE)gcc' ""
34 '';
35
36 enableParallelBuilding = true;
37
38 makeFlags = [
39 "SHARED=${lib.boolToYesNo (!static)}"
40 "PREFIX=\${out}"
41 "STRIP="
42 "HOST=${stdenv.hostPlatform.system}"
43 "CROSS_COMPILE=${stdenv.cc.targetPrefix}"
44 "DNS=yes"
45 ];
46
47 installTargets = [
48 "install"
49 "install-lib"
50 ];
51
52 postInstall = ''
53 # Remove update-pciids as it won't work on nixos
54 rm $out/sbin/update-pciids $out/man/man8/update-pciids.8
55
56 # use database from hwdata instead
57 # (we don't create a symbolic link because we do not want to pull in the
58 # full closure of hwdata)
59 cp --reflink=auto ${hwdata}/share/hwdata/pci.ids $out/share/pci.ids
60 '';
61
62 passthru.updateScript = gitUpdater {
63 # No nicer place to find latest release.
64 url = "https://github.com/pciutils/pciutils.git";
65 rev-prefix = "v";
66 };
67
68 meta = {
69 homepage = "https://mj.ucw.cz/sw/pciutils/";
70 description = "Collection of programs for inspecting and manipulating configuration of PCI devices";
71 license = lib.licenses.gpl2Plus;
72 platforms = lib.platforms.unix;
73 maintainers = [ lib.maintainers.vcunat ]; # not really, but someone should watch it
74 mainProgram = "lspci";
75 };
76}