2021-10-07 23:43:16 +02:00
|
|
|
{ fetchurl
|
2021-10-08 01:28:49 +02:00
|
|
|
, gcc9Stdenv
|
2021-10-07 23:43:16 +02:00
|
|
|
, installShellFiles
|
|
|
|
, lib
|
2020-02-16 21:14:13 +01:00
|
|
|
, libftdi1
|
2021-10-07 23:43:16 +02:00
|
|
|
, libjaylink
|
2020-02-16 21:14:13 +01:00
|
|
|
, libusb1
|
|
|
|
, pciutils
|
2021-10-07 23:43:16 +02:00
|
|
|
, pkg-config
|
|
|
|
, jlinkSupport ? false
|
2020-02-16 21:14:13 +01:00
|
|
|
}:
|
2014-08-28 23:27:28 +02:00
|
|
|
|
2021-10-08 01:28:49 +02:00
|
|
|
gcc9Stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "flashrom";
|
2020-02-12 09:37:44 +01:00
|
|
|
version = "1.2";
|
2014-08-28 23:27:28 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-04-02 08:04:37 +02:00
|
|
|
url = "https://download.flashrom.org/releases/flashrom-v${version}.tar.bz2";
|
2020-02-12 09:37:44 +01:00
|
|
|
sha256 = "0ax4kqnh7kd3z120ypgp73qy1knz47l6qxsqzrfkd97mh5cdky71";
|
2014-08-28 23:27:28 +02:00
|
|
|
};
|
|
|
|
|
2021-10-07 23:43:16 +02:00
|
|
|
nativeBuildInputs = [ pkg-config installShellFiles ];
|
|
|
|
buildInputs = [ libftdi1 libusb1 ]
|
|
|
|
# https://github.com/flashrom/flashrom/issues/125
|
|
|
|
++ lib.optional (!gcc9Stdenv.isAarch64) pciutils
|
|
|
|
++ lib.optional jlinkSupport libjaylink;
|
|
|
|
|
2021-06-26 03:37:52 +02:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace util/z60_flashrom.rules \
|
|
|
|
--replace "plugdev" "flashrom"
|
|
|
|
'';
|
|
|
|
|
2021-10-07 23:43:16 +02:00
|
|
|
makeFlags = [ "PREFIX=$(out)" "libinstall" ]
|
|
|
|
++ lib.optional jlinkSupport "CONFIG_JLINK_SPI=yes";
|
2021-10-08 01:28:49 +02:00
|
|
|
|
2021-06-09 00:27:09 +02:00
|
|
|
postInstall = ''
|
2021-10-08 01:28:49 +02:00
|
|
|
install -Dm644 util/z60_flashrom.rules $out/lib/udev/rules.d/flashrom.rules
|
2021-06-09 00:27:09 +02:00
|
|
|
'';
|
|
|
|
|
2018-01-28 04:04:14 +01:00
|
|
|
meta = with lib; {
|
2021-10-07 23:43:16 +02:00
|
|
|
homepage = "https://www.flashrom.org";
|
2014-08-28 23:27:28 +02:00
|
|
|
description = "Utility for reading, writing, erasing and verifying flash ROM chips";
|
2018-01-28 04:04:14 +01:00
|
|
|
license = licenses.gpl2;
|
2021-07-01 04:54:38 +02:00
|
|
|
maintainers = with maintainers; [ funfunctor fpletz felixsinger ];
|
2020-02-16 21:14:13 +01:00
|
|
|
platforms = platforms.all;
|
2021-10-08 01:28:49 +02:00
|
|
|
broken = gcc9Stdenv.isDarwin; # requires DirectHW
|
2014-08-28 23:27:28 +02:00
|
|
|
};
|
|
|
|
}
|