summary refs log tree commit diff
path: root/pkgs/tools/misc/esptool
diff options
context:
space:
mode:
authorRobert Schütz <nix@dotlambda.de>2022-11-27 12:25:03 -0800
committerRobert Schütz <nix@dotlambda.de>2022-11-27 14:35:11 -0800
commitdf6b943ad047cdfac3d6a82a339d0572a0db2cd0 (patch)
treedf22d9cf25ddcc5bad504fd9a8146bb6e3aada49 /pkgs/tools/misc/esptool
parent4884ac130816156095e69544257701fc620d4b36 (diff)
downloadnixpkgs-df6b943ad047cdfac3d6a82a339d0572a0db2cd0.tar
nixpkgs-df6b943ad047cdfac3d6a82a339d0572a0db2cd0.tar.gz
nixpkgs-df6b943ad047cdfac3d6a82a339d0572a0db2cd0.tar.bz2
nixpkgs-df6b943ad047cdfac3d6a82a339d0572a0db2cd0.tar.lz
nixpkgs-df6b943ad047cdfac3d6a82a339d0572a0db2cd0.tar.xz
nixpkgs-df6b943ad047cdfac3d6a82a339d0572a0db2cd0.tar.zst
nixpkgs-df6b943ad047cdfac3d6a82a339d0572a0db2cd0.zip
esptool_3: init at 3.3.2
Diffstat (limited to 'pkgs/tools/misc/esptool')
-rw-r--r--pkgs/tools/misc/esptool/3.nix63
1 files changed, 63 insertions, 0 deletions
diff --git a/pkgs/tools/misc/esptool/3.nix b/pkgs/tools/misc/esptool/3.nix
new file mode 100644
index 00000000000..3ffa79b8c8b
--- /dev/null
+++ b/pkgs/tools/misc/esptool/3.nix
@@ -0,0 +1,63 @@
+{ lib, fetchFromGitHub, python3, openssl }:
+
+python3.pkgs.buildPythonApplication rec {
+  pname = "esptool";
+  version = "3.3.2";
+
+  src = fetchFromGitHub {
+    owner = "espressif";
+    repo = "esptool";
+    rev = "v${version}";
+    hash = "sha256-hpPL9KNPA+S57SJoKnQewBCOybDbKep0t5RKw9a9GjM=";
+  };
+
+  postPatch = ''
+    substituteInPlace test/test_imagegen.py \
+      --replace "sys.executable, ESPTOOL_PY" "ESPTOOL_PY"
+  '';
+
+  propagatedBuildInputs = with python3.pkgs; [
+    bitstring
+    cryptography
+    ecdsa
+    pyserial
+    reedsolo
+  ];
+
+  # wrapPythonPrograms will overwrite esptool.py with a bash script,
+  # but espefuse.py tries to import it. Since we don't add any binary paths,
+  # use patchPythonScript directly.
+  dontWrapPythonPrograms = true;
+  postFixup = ''
+    buildPythonPath "$out $pythonPath"
+    for f in $out/bin/*.py; do
+        echo "Patching $f"
+        patchPythonScript "$f"
+    done
+  '';
+
+  checkInputs = with python3.pkgs; [
+    pyelftools
+  ];
+
+  # tests mentioned in `.github/workflows/test_esptool.yml`
+  checkPhase = ''
+    runHook preCheck
+
+    export ESPTOOL_PY=$out/bin/esptool.py
+    ${python3.interpreter} test/test_imagegen.py
+    ${python3.interpreter} test/test_espsecure.py
+    ${python3.interpreter} test/test_merge_bin.py
+    ${python3.interpreter} test/test_modules.py
+
+    runHook postCheck
+  '';
+
+  meta = with lib; {
+    description = "ESP8266 and ESP32 serial bootloader utility";
+    homepage = "https://github.com/espressif/esptool";
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ hexa ];
+    platforms = platforms.linux;
+  };
+}