60 lines
1.6 KiB
Nix
60 lines
1.6 KiB
Nix
{
|
|
pkgs ? import <nixpkgs> {},
|
|
system ? builtins.currentSystem,
|
|
}: let
|
|
systems_table = {
|
|
"x86_64-linux" = {
|
|
system = "x86_64-unknown-linux-gnu";
|
|
hash = "1pilzw6lqygysdrklzs64vb07a3ni0pw24qklkwc5gjqwgzc4ka4";
|
|
};
|
|
"x86_64-darwin" = {
|
|
system = "x86_64-apple-darwin";
|
|
hash = "09j72xspg1bq82hk9w9ij9h17yk4lr0wfv20ybm1pah4bfxw6mha";
|
|
};
|
|
"aarch64-linux" = {
|
|
system = "aarch64-unknown-linux-gnu";
|
|
hash = "170013pw7rllqzc03i39xrwy486jllxjjh53sgnywqz0ylycx7j8";
|
|
};
|
|
"aarch64-darwin" = {
|
|
system = "aarch64-apple-darwin";
|
|
hash = "143kb7vawssg6b5h8c7k4szm43qqif3sjniwzc60avhn60zrc00j";
|
|
};
|
|
};
|
|
download_system = systems_table.${system};
|
|
in
|
|
pkgs.stdenv.mkDerivation rec {
|
|
pname = "esp-rust";
|
|
version = "1.81.0.0";
|
|
srcs = [
|
|
(builtins.fetchurl
|
|
{
|
|
url = "https://github.com/esp-rs/rust-build/releases/download/v${version}/rust-${version}-${download_system.system}.tar.xz";
|
|
sha256 = download_system.hash;
|
|
})
|
|
(builtins.fetchurl
|
|
{
|
|
url = "https://github.com/esp-rs/rust-build/releases/download/v${version}/rust-src-${version}.tar.xz";
|
|
sha256 = "0w7fy0biml8ddvwpmrn9js4x6vkqjhm118gxy2431fnxl97v947f";
|
|
})
|
|
];
|
|
sourceRoot = ".";
|
|
|
|
preferLocalBuild = true;
|
|
|
|
nativeBuildInputs = with pkgs; [
|
|
autoPatchelfHook
|
|
];
|
|
|
|
buildInputs = with pkgs; [
|
|
stdenv.cc.cc.lib
|
|
libz
|
|
];
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
mkdir -p "$out"
|
|
cp -R ./*/*/{bin,share,lib} "$out"
|
|
runHook postInstall
|
|
'';
|
|
}
|