Last active
September 7, 2019 13:24
-
-
Save fbmnds/56b74de6f87fc4a1fb4c46db3af6d4fa to your computer and use it in GitHub Desktop.
ESP-IDF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ stdenv, fetchurl, makeWrapper, buildFHSUserEnv }: | |
let | |
fhsEnv = buildFHSUserEnv { | |
name = "esp32-toolchain-env"; | |
targetPkgs = pkgs: with pkgs; [ zlib ]; | |
runScript = ""; | |
}; | |
in | |
stdenv.mkDerivation rec { | |
name = "esp32-toolchain"; | |
version = "2019r1"; | |
src = fetchurl { | |
url = "https://dl.espressif.com/dl/xtensa-esp32-elf-gcc8_2_0-esp32-2019r1-linux-amd64.tar.gz"; | |
sha256 = "02iz5n8as29mhgg7kb9667rbfxyfpyfrfmjzqm9kxs157yqmknrr"; | |
}; | |
buildInputs = [ makeWrapper ]; | |
phases = [ "unpackPhase" "installPhase" ]; | |
installPhase = '' | |
cp -r . $out{ nixpkgs ? import <nixpkgs> {} }: | |
let | |
inherit (nixpkgs) pkgs; | |
in | |
pkgs.stdenv.mkDerivation { | |
name = "esp-idf-env"; | |
buildInputs = with pkgs; [ | |
cmake gawk gperf gettext automake bison flex texinfo help2man libtool autoconf ncurses5 cmake | |
(python37.withPackages (ppkgs: with ppkgs; [ pyserial future cryptography click pyelftools ])) | |
(pkgs.callPackage ~/esp/esp32-toolchain.nix {}) | |
]; | |
shellHook = '' | |
export NIX_CFLAGS_LINK=-lncurses | |
export IDF_PATH=$HOME/esp/esp-idf | |
''; | |
} | |
for FILE in $(ls $out/bin); do | |
FILE_PATH="$out/bin/$FILE" | |
if [[ -x $FILE_PATH ]]; then | |
mv $FILE_PATH $FILE_PATH-unwrapped | |
makeWrapper ${fhsEnv}/bin/esp32-toolchain-env $FILE_PATH --add-flags "$FILE_PATH-unwrapped" | |
fi | |
done | |
''; | |
meta = with stdenv.lib; { | |
description = "ESP32 toolchain"; | |
homepage = https://docs.espressif.com/projects/esp-idf/en/stable/get-started/linux-setup.html; | |
license = licenses.gpl3; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment