2021-10-17 09:34:42 +00:00
|
|
|
{ fetchurl
|
2021-12-06 16:07:01 +00:00
|
|
|
, fetchpatch
|
|
|
|
, stdenv
|
2021-10-17 09:34:42 +00:00
|
|
|
, installShellFiles
|
|
|
|
, lib
|
2020-04-24 23:36:52 +00:00
|
|
|
, libftdi1
|
2021-10-17 09:34:42 +00:00
|
|
|
, libjaylink
|
2020-04-24 23:36:52 +00:00
|
|
|
, libusb1
|
|
|
|
, pciutils
|
2021-10-17 09:34:42 +00:00
|
|
|
, pkg-config
|
|
|
|
, jlinkSupport ? false
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "flashrom";
|
2023-02-16 17:41:37 +00:00
|
|
|
version = "1.3.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://download.flashrom.org/releases/flashrom-v${version}.tar.bz2";
|
2023-02-16 17:41:37 +00:00
|
|
|
hash = "sha256-oFMjRFPM0BLnnzRDvcxhYlz5e3/Xy0zdi/v/vosUliM=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-10-17 09:34:42 +00:00
|
|
|
nativeBuildInputs = [ pkg-config installShellFiles ];
|
2021-12-06 16:07:01 +00:00
|
|
|
buildInputs = [ libftdi1 libusb1 pciutils ]
|
2021-10-17 09:34:42 +00:00
|
|
|
++ lib.optional jlinkSupport libjaylink;
|
|
|
|
|
2021-07-03 03:11:41 +00:00
|
|
|
postPatch = ''
|
2023-02-16 17:41:37 +00:00
|
|
|
substituteInPlace util/flashrom_udev.rules \
|
2021-07-03 03:11:41 +00:00
|
|
|
--replace "plugdev" "flashrom"
|
|
|
|
'';
|
|
|
|
|
2021-10-17 09:34:42 +00:00
|
|
|
makeFlags = [ "PREFIX=$(out)" "libinstall" ]
|
|
|
|
++ lib.optional jlinkSupport "CONFIG_JLINK_SPI=yes";
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
postInstall = ''
|
2023-02-16 17:41:37 +00:00
|
|
|
install -Dm644 util/flashrom_udev.rules $out/lib/udev/rules.d/flashrom.rules
|
2021-06-28 23:13:55 +00:00
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
2021-10-17 09:34:42 +00:00
|
|
|
homepage = "https://www.flashrom.org";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Utility for reading, writing, erasing and verifying flash ROM chips";
|
|
|
|
license = licenses.gpl2;
|
2022-07-14 12:49:19 +00:00
|
|
|
maintainers = with maintainers; [ fpletz felixsinger ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.all;
|
2021-12-06 16:07:01 +00:00
|
|
|
broken = stdenv.isDarwin; # requires DirectHW
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|