nixpkgs/pkgs/by-name/es/esptool/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

79 lines
1.8 KiB
Nix

{ lib
, fetchFromGitHub
, python3Packages
, softhsm
}:
python3Packages.buildPythonApplication rec {
pname = "esptool";
version = "4.8.1";
pyproject = true;
src = fetchFromGitHub {
owner = "espressif";
repo = "esptool";
rev = "refs/tags/v${version}";
hash = "sha256-cNEg2a3j7Vql06GwVaE9y86UtMkNsUdJYM00OEUra2w=";
};
postPatch = ''
patchShebangs ci
substituteInPlace test/test_espsecure_hsm.py \
--replace-fail "/usr/lib/softhsm" "${lib.getLib softhsm}/lib/softhsm"
'';
build-system = with python3Packages; [
setuptools
];
dependencies = with python3Packages; [
argcomplete
bitstring
cryptography
ecdsa
intelhex
pyserial
reedsolo
pyyaml
];
optional-dependencies = with python3Packages; {
hsm = [ python-pkcs11 ];
};
nativeCheckInputs = with python3Packages; [
pyelftools
pytestCheckHook
softhsm
] ++ lib.flatten (lib.attrValues optional-dependencies);
# tests mentioned in `.github/workflows/test_esptool.yml`
checkPhase = ''
runHook preCheck
export SOFTHSM2_CONF=$(mktemp)
echo "directories.tokendir = $(mktemp -d)" > "$SOFTHSM2_CONF"
./ci/setup_softhsm2.sh
pytest test/test_imagegen.py
pytest test/test_espsecure.py
pytest test/test_espsecure_hsm.py
pytest test/test_merge_bin.py
pytest test/test_image_info.py
pytest test/test_modules.py
runHook postCheck
'';
meta = with lib; {
changelog = "https://github.com/espressif/esptool/blob/${src.rev}/CHANGELOG.md";
description = "ESP8266 and ESP32 serial bootloader utility";
homepage = "https://github.com/espressif/esptool";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ dezgeg dotlambda ] ++ teams.lumiguide.members;
platforms = with platforms; linux ++ darwin;
mainProgram = "esptool.py";
};
}