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
|
2023-01-20 10:41:00 +00:00
|
|
|
, gitUpdater
|
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";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "3.12.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";
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-8YXRFtX/mbeXSX786PGfHujMxaZouXoVnj0TRy9nQVQ=";
|
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
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
passthru.updateScript = gitUpdater {
|
|
|
|
# No nicer place to find latest release.
|
|
|
|
url = "https://github.com/pciutils/pciutils.git";
|
|
|
|
rev-prefix = "v";
|
|
|
|
};
|
|
|
|
|
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/";
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Collection of programs for inspecting and manipulating configuration of PCI devices";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.gpl2Plus;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = [ maintainers.vcunat ]; # not really, but someone should watch it
|
2024-05-15 15:35:15 +00:00
|
|
|
mainProgram = "lspci";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|