mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-29 10:23:29 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
49 lines
1.4 KiB
Nix
49 lines
1.4 KiB
Nix
{ fetchurl
|
|
, stdenv
|
|
, installShellFiles
|
|
, lib
|
|
, libftdi1
|
|
, libjaylink
|
|
, libusb1
|
|
, pciutils
|
|
, pkg-config
|
|
, jlinkSupport ? false
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "flashrom";
|
|
version = "1.3.0";
|
|
|
|
src = fetchurl {
|
|
url = "https://download.flashrom.org/releases/flashrom-v${version}.tar.bz2";
|
|
hash = "sha256-oFMjRFPM0BLnnzRDvcxhYlz5e3/Xy0zdi/v/vosUliM=";
|
|
};
|
|
|
|
nativeBuildInputs = [ pkg-config installShellFiles ];
|
|
buildInputs = [ libftdi1 libusb1 ]
|
|
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ pciutils ]
|
|
++ lib.optional jlinkSupport libjaylink;
|
|
|
|
postPatch = ''
|
|
substituteInPlace util/flashrom_udev.rules \
|
|
--replace 'GROUP="plugdev"' 'TAG+="uaccess", TAG+="udev-acl"'
|
|
'';
|
|
|
|
makeFlags = [ "PREFIX=$(out)" "libinstall" ]
|
|
++ lib.optional jlinkSupport "CONFIG_JLINK_SPI=yes"
|
|
++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [ "CONFIG_INTERNAL_X86=no" "CONFIG_INTERNAL_DMI=no" "CONFIG_RAYER_SPI=no" ];
|
|
|
|
postInstall = ''
|
|
install -Dm644 util/flashrom_udev.rules $out/lib/udev/rules.d/flashrom.rules
|
|
'';
|
|
|
|
meta = with lib; {
|
|
homepage = "https://www.flashrom.org";
|
|
description = "Utility for reading, writing, erasing and verifying flash ROM chips";
|
|
license = licenses.gpl2Plus;
|
|
maintainers = with maintainers; [ fpletz felixsinger ];
|
|
platforms = platforms.all;
|
|
mainProgram = "flashrom";
|
|
};
|
|
}
|