nix-esp-rust/clang.nix
2026-05-04 00:25:43 +02:00

46 lines
1.2 KiB
Nix

{
pkgs ? import <nixpkgs> {},
system ? builtins.currentSystem,
}: let
systems_table = {
"x86_64-linux" = {
system = "x86_64-linux-gnu";
binhash = "sha256:0qyspqgz6w4ccvs4xxwd7l5yflz9ccacx0fjma456yxmfccvyqkf";
libhash = "sha256:1wwp25npbsj0amg8vd8vfbjjagyzpf665rpnrn99dzm1y3shcm67";
};
};
system_download = systems_table.${system};
in
pkgs.stdenv.mkDerivation rec {
pname = "esp-clang";
version = "21.1.3_20260408";
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"
'';
}