2022-12-02 08:20:57 +00:00
|
|
|
{ lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, python3
|
2023-10-09 19:29:22 +00:00
|
|
|
, softhsm
|
2022-12-02 08:20:57 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
python3.pkgs.buildPythonApplication rec {
|
|
|
|
pname = "esptool";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "4.6.2";
|
|
|
|
|
|
|
|
format = "setuptools";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "espressif";
|
|
|
|
repo = "esptool";
|
|
|
|
rev = "v${version}";
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-3uvTyJrGCpulu/MR/VfCgnIxibxJj2ehBIBSveq7EfI=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs ci
|
|
|
|
|
|
|
|
substituteInPlace test/test_espsecure_hsm.py \
|
|
|
|
--replace "/usr/lib/softhsm" "${lib.getLib softhsm}/lib/softhsm"
|
|
|
|
'';
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
propagatedBuildInputs = with python3.pkgs; [
|
|
|
|
bitstring
|
|
|
|
cryptography
|
|
|
|
ecdsa
|
|
|
|
pyserial
|
|
|
|
reedsolo
|
2023-10-09 19:29:22 +00:00
|
|
|
pyyaml
|
|
|
|
python-pkcs11
|
2022-05-18 14:49:53 +00:00
|
|
|
];
|
2020-12-25 13:55:36 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = with python3.pkgs; [
|
2022-05-18 14:49:53 +00:00
|
|
|
pyelftools
|
2023-02-22 10:55:15 +00:00
|
|
|
pytestCheckHook
|
2023-10-09 19:29:22 +00:00
|
|
|
softhsm
|
2022-05-18 14:49:53 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
# tests mentioned in `.github/workflows/test_esptool.yml`
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
export SOFTHSM2_CONF=$(mktemp)
|
|
|
|
echo "directories.tokendir = $(mktemp -d)" > "$SOFTHSM2_CONF"
|
|
|
|
./ci/setup_softhsm2.sh
|
|
|
|
|
2023-02-22 10:55:15 +00:00
|
|
|
pytest test/test_imagegen.py
|
|
|
|
pytest test/test_espsecure.py
|
2023-10-09 19:29:22 +00:00
|
|
|
pytest test/test_espsecure_hsm.py
|
2023-02-22 10:55:15 +00:00
|
|
|
pytest test/test_merge_bin.py
|
|
|
|
pytest test/test_image_info.py
|
|
|
|
pytest test/test_modules.py
|
2022-05-18 14:49:53 +00:00
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "ESP8266 and ESP32 serial bootloader utility";
|
|
|
|
homepage = "https://github.com/espressif/esptool";
|
2021-07-21 07:28:18 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2022-06-16 17:23:12 +00:00
|
|
|
maintainers = with maintainers; [ dezgeg dotlambda ] ++ teams.lumiguide.members;
|
2023-03-04 12:14:45 +00:00
|
|
|
platforms = with platforms; linux ++ darwin;
|
2023-05-24 13:37:59 +00:00
|
|
|
mainProgram = "esptool.py";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|