Unbork journals audit logs and introduce audit option (#379629)
[NixPkgs.git] / pkgs / by-name / es / esptool / package.nix
bloba77cb5e750d7c2346da660265e7bf8c02a93b898
2   lib,
3   fetchFromGitHub,
4   python3Packages,
5   softhsm,
6 }:
8 python3Packages.buildPythonApplication rec {
9   pname = "esptool";
10   version = "4.8.1";
11   pyproject = true;
13   src = fetchFromGitHub {
14     owner = "espressif";
15     repo = "esptool";
16     tag = "v${version}";
17     hash = "sha256-cNEg2a3j7Vql06GwVaE9y86UtMkNsUdJYM00OEUra2w=";
18   };
20   postPatch = ''
21     patchShebangs ci
23     substituteInPlace test/test_espsecure_hsm.py \
24       --replace-fail "/usr/lib/softhsm" "${lib.getLib softhsm}/lib/softhsm"
25   '';
27   build-system = with python3Packages; [
28     setuptools
29   ];
31   dependencies = with python3Packages; [
32     argcomplete
33     bitstring
34     cryptography
35     ecdsa
36     intelhex
37     pyserial
38     reedsolo
39     pyyaml
40   ];
42   optional-dependencies = with python3Packages; {
43     hsm = [ python-pkcs11 ];
44   };
46   nativeCheckInputs =
47     with python3Packages;
48     [
49       pyelftools
50       pytestCheckHook
51       softhsm
52     ]
53     ++ lib.flatten (lib.attrValues optional-dependencies);
55   # tests mentioned in `.github/workflows/test_esptool.yml`
56   checkPhase = ''
57     runHook preCheck
59     export SOFTHSM2_CONF=$(mktemp)
60     echo "directories.tokendir = $(mktemp -d)" > "$SOFTHSM2_CONF"
61     ./ci/setup_softhsm2.sh
63     pytest test/test_imagegen.py
64     pytest test/test_espsecure.py
65     pytest test/test_espsecure_hsm.py
66     pytest test/test_merge_bin.py
67     pytest test/test_image_info.py
68     pytest test/test_modules.py
70     runHook postCheck
71   '';
73   meta = with lib; {
74     changelog = "https://github.com/espressif/esptool/blob/${src.rev}/CHANGELOG.md";
75     description = "ESP8266 and ESP32 serial bootloader utility";
76     homepage = "https://github.com/espressif/esptool";
77     license = licenses.gpl2Plus;
78     maintainers =
79       with maintainers;
80       [
81         dezgeg
82         dotlambda
83       ]
84       ++ teams.lumiguide.members;
85     platforms = with platforms; linux ++ darwin;
86     mainProgram = "esptool.py";
87   };