mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-30 19:02:57 +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" ```
64 lines
1.6 KiB
Nix
64 lines
1.6 KiB
Nix
{ fetchgit
|
|
, installShellFiles
|
|
, lib
|
|
, libftdi1
|
|
, libgpiod
|
|
, libjaylink
|
|
, libusb1
|
|
, pciutils
|
|
, pkg-config
|
|
, stdenv
|
|
, withJlink ? true
|
|
, withGpio ? stdenv.hostPlatform.isLinux
|
|
}:
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "flashprog";
|
|
version = "1.2";
|
|
|
|
src = fetchgit {
|
|
url = "https://review.sourcearcade.org/flashprog";
|
|
rev = "v${finalAttrs.version}";
|
|
hash = "sha256-Z09hZ4a/G3DhWCmSkPyKs7ecSFBUfez7IWWxIhH3LyI=";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
installShellFiles
|
|
pkg-config
|
|
];
|
|
buildInputs = [
|
|
libftdi1
|
|
libusb1
|
|
] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
|
|
pciutils
|
|
] ++ lib.optionals (withJlink) [
|
|
libjaylink
|
|
] ++ lib.optionals (withGpio) [
|
|
libgpiod
|
|
];
|
|
|
|
makeFlags =
|
|
let
|
|
yesNo = flag: if flag then "yes" else "no";
|
|
in
|
|
[
|
|
"libinstall"
|
|
"PREFIX=$(out)"
|
|
"CONFIG_JLINK_SPI=${yesNo withJlink}"
|
|
"CONFIG_LINUX_GPIO_SPI=${yesNo withGpio}"
|
|
"CONFIG_ENABLE_LIBPCI_PROGRAMMERS=${yesNo (!stdenv.hostPlatform.isDarwin)}"
|
|
"CONFIG_INTERNAL_X86=${yesNo (!(stdenv.hostPlatform.isDarwin) && stdenv.hostPlatform.isx86_64)}"
|
|
"CONFIG_INTERNAL_DMI=${yesNo (!(stdenv.hostPlatform.isDarwin) && stdenv.hostPlatform.isx86_64)}"
|
|
"CONFIG_RAYER_SPI=${yesNo (!(stdenv.hostPlatform.isDarwin) && stdenv.hostPlatform.isx86_64)}"
|
|
];
|
|
|
|
meta = with lib; {
|
|
homepage = "https://flashprog.org";
|
|
description = "Utility for reading, writing, erasing and verifying flash ROM chips";
|
|
license = with licenses; [ gpl2Plus ];
|
|
maintainers = with maintainers; [ felixsinger funkeleinhorn ];
|
|
platforms = platforms.all;
|
|
mainProgram = "flashprog";
|
|
};
|
|
})
|