2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchurl, pkg-config, zlib, kmod, which
|
2021-03-09 03:18:52 +00:00
|
|
|
, hwdata
|
2021-01-05 17:05:55 +00:00
|
|
|
, static ? stdenv.hostPlatform.isStatic
|
2021-02-17 17:02:09 +00:00
|
|
|
, IOKit
|
2020-09-25 04:45:31 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2021-08-22 07:53:02 +00:00
|
|
|
pname = "pciutils";
|
|
|
|
version = "3.7.0"; # with release-date database
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-08-22 07:53:02 +00:00
|
|
|
url = "mirror://kernel/software/utils/pciutils/pciutils-${version}.tar.xz";
|
2020-06-15 15:56:04 +00:00
|
|
|
sha256 = "1ss0rnfsx8gvqjxaji4mvbhf9xyih4cadmgadbwwv8mnx1xvjh4x";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2020-10-07 09:15:18 +00:00
|
|
|
buildInputs = [ zlib kmod which ] ++
|
2021-02-17 17:02:09 +00:00
|
|
|
lib.optional stdenv.hostPlatform.isDarwin IOKit;
|
2020-10-07 09:15:18 +00:00
|
|
|
|
|
|
|
preConfigure = if stdenv.cc.isGNU then null else ''
|
|
|
|
substituteInPlace Makefile --replace 'CC=$(CROSS_COMPILE)gcc' ""
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
makeFlags = [
|
2020-09-25 04:45:31 +00:00
|
|
|
"SHARED=${if static then "no" else "yes"}"
|
2020-04-24 23:36:52 +00:00
|
|
|
"PREFIX=\${out}"
|
|
|
|
"STRIP="
|
|
|
|
"HOST=${stdenv.hostPlatform.system}"
|
|
|
|
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
|
|
|
|
"DNS=yes"
|
|
|
|
];
|
|
|
|
|
|
|
|
installTargets = [ "install" "install-lib" ];
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
postInstall = ''
|
|
|
|
# Remove update-pciids as it won't work on nixos
|
|
|
|
rm $out/sbin/update-pciids $out/man/man8/update-pciids.8
|
|
|
|
|
|
|
|
# use database from hwdata instead
|
|
|
|
# (we don't create a symbolic link because we do not want to pull in the
|
|
|
|
# full closure of hwdata)
|
|
|
|
cp --reflink=auto ${hwdata}/share/hwdata/pci.ids $out/share/pci.ids
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "http://mj.ucw.cz/pciutils.html";
|
|
|
|
description = "A collection of programs for inspecting and manipulating configuration of PCI devices";
|
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = [ maintainers.vcunat ]; # not really, but someone should watch it
|
|
|
|
};
|
|
|
|
}
|