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" ```
76 lines
1.4 KiB
Nix
76 lines
1.4 KiB
Nix
{ lib
|
|
, stdenv
|
|
, fetchFromGitHub
|
|
, python3
|
|
, snagboot
|
|
, testers
|
|
, gitUpdater
|
|
}:
|
|
|
|
python3.pkgs.buildPythonApplication rec {
|
|
pname = "snagboot";
|
|
version = "1.3";
|
|
format = "pyproject";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "bootlin";
|
|
repo = "snagboot";
|
|
rev = "v${version}";
|
|
hash = "sha256-ergTa6uR1SyR27H2HAWp/rtgalCnQge07Pi24PrsW+8=";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
];
|
|
|
|
pythonRemoveDeps = [
|
|
"pylibfdt"
|
|
"swig"
|
|
];
|
|
|
|
propagatedBuildInputs = with python3.pkgs; [
|
|
setuptools
|
|
pyusb
|
|
pyserial
|
|
crccheck
|
|
six
|
|
xmodem
|
|
pyyaml
|
|
libfdt
|
|
tftpy
|
|
];
|
|
|
|
postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
|
|
rules="src/snagrecover/50-snagboot.rules"
|
|
if [ ! -f "$rules" ]; then
|
|
echo "$rules is missing, must update the Nix file."
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p "$out/lib/udev/rules.d"
|
|
cp "$rules" "$out/lib/udev/rules.d/50-snagboot.rules"
|
|
'';
|
|
|
|
# There are no tests
|
|
doCheck = false;
|
|
|
|
passthru = {
|
|
updateScript = gitUpdater {
|
|
rev-prefix = "v";
|
|
ignoredVersions = ".(rc|beta).*";
|
|
};
|
|
|
|
tests.version = testers.testVersion {
|
|
package = snagboot;
|
|
command = "snagrecover --version";
|
|
version = "v${version}";
|
|
};
|
|
};
|
|
|
|
meta = {
|
|
homepage = "https://github.com/bootlin/snagboot";
|
|
description = "Generic recovery and reflashing tool for embedded platforms";
|
|
license = lib.licenses.gpl2;
|
|
maintainers = with lib.maintainers; [ otavio ];
|
|
};
|
|
}
|