2021-10-17 09:34:42 +00:00
|
|
|
{ fetchurl
|
2021-12-06 16:07:01 +00:00
|
|
|
, 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 ];
|
2023-05-24 13:37:59 +00:00
|
|
|
buildInputs = [ libftdi1 libusb1 ]
|
2023-07-15 17:15:38 +00:00
|
|
|
++ lib.optionals (!stdenv.isDarwin) [ 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 \
|
2023-02-22 10:55:15 +00:00
|
|
|
--replace 'GROUP="plugdev"' 'TAG+="uaccess", TAG+="udev-acl"'
|
2021-07-03 03:11:41 +00:00
|
|
|
'';
|
|
|
|
|
2021-10-17 09:34:42 +00:00
|
|
|
makeFlags = [ "PREFIX=$(out)" "libinstall" ]
|
2023-05-24 13:37:59 +00:00
|
|
|
++ lib.optional jlinkSupport "CONFIG_JLINK_SPI=yes"
|
|
|
|
++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [ "CONFIG_INTERNAL_X86=no" "CONFIG_INTERNAL_DMI=no" "CONFIG_RAYER_SPI=no" ];
|
2021-10-17 09:34:42 +00:00
|
|
|
|
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;
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "flashrom";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|