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 ];
|
2022-08-12 12:06:08 +00:00
|
|
|
buildInputs = [ which zlib ]
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [ IOKit ]
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isLinux [ kmod ];
|
2020-10-07 09:15:18 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
preConfigure = lib.optionalString (!stdenv.cc.isGNU) ''
|
2020-10-07 09:15:18 +00:00
|
|
|
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; {
|
2022-07-14 12:49:19 +00:00
|
|
|
homepage = "https://mj.ucw.cz/sw/pciutils/";
|
2020-04-24 23:36:52 +00:00
|
|
|
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
|
|
|
|
};
|
|
|
|
}
|