{ pkgs ? import {}, system ? builtins.currentSystem, }: let systems_table = { "x86_64-linux" = { system = "x86_64-linux-gnu"; binhash = "aee15b8e02440f9ec6a8070f017621dc400dbd62a4701f9cf456dbe34d2a0c4d"; libhash = "cfd6fcb41d6d3651e3e7bdbb37d0e0b691b43e680dff4c998cf77f7e4ecd05c5"; }; "x86_64-darwin" = { system = "x86_64-apple-darwin"; binhash = "b4641ec4dd574b6b7d037aa1bb2e5ff5a8a4623c88e89668db656282eb1d9dc8"; libhash = "80c086c29235016382b9ab95b41556ff5bdb40186f7f1c60c64acb2af420607b"; }; "aarch64-linux" = { system = "aarch64-linux-gnu"; binhash = "14abbc368d9c153270aa4d22ce28d78633cb0f1ca83d4be70591d9e39ae9bc82"; libhash = "d49dfda7331a26b5d0da41bac91d5240a14ee731cbfa49f1ead3aa6377bd1b7e"; }; "aarch64-darwin" = { system = "aarch64-apple-darwin"; binhash = "5d2e187ef40ecc9996630a7c6efcc19bdfd32ec4ce8cc4dd3014cd24e7016560"; libhash = "8b9c6bab01bffaed5f24e37e6e255bc4e0905cd175473e7d480f301f9b0d3f0d"; }; }; system_download = systems_table.${system}; in pkgs.stdenv.mkDerivation rec { pname = "esp-clang"; version = "18.1.2_20240912"; srcs = [ (builtins.fetchurl { url = "https://github.com/espressif/llvm-project/releases/download/esp-${version}/clang-esp-${version}-${system_download.system}.tar.xz"; sha256 = system_download.binhash; }) (builtins.fetchurl { url = "https://github.com/espressif/llvm-project/releases/download/esp-${version}/libs-clang-esp-${version}-${system_download.system}.tar.xz"; sha256 = system_download.libhash; }) ]; preferLocalBuild = true; nativeBuildInputs = with pkgs; [ autoPatchelfHook ]; buildInputs = with pkgs; [ stdenv.cc.cc.lib libz libxml2 ]; installPhase = '' mkdir -p "$out" cp -R ./{bin,share,lib,include} "$out" ''; }