add support for more systems
This commit is contained in:
parent
cccea58966
commit
1ee35d233f
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
/result
|
||||||
|
/esp-clang
|
||||||
|
.null-ls*
|
87
clang.nix
87
clang.nix
@ -1,34 +1,61 @@
|
|||||||
{pkgs ? import <nixpkgs> {}}:
|
{
|
||||||
pkgs.stdenv.mkDerivation rec {
|
pkgs ? import <nixpkgs> {},
|
||||||
pname = "esp-clang";
|
system ? builtins.currentSystem,
|
||||||
version = "18.1.2_20240912";
|
}: let
|
||||||
srcs = [
|
systems_table = {
|
||||||
(builtins.fetchurl
|
"x86_64-linux" = {
|
||||||
{
|
system = "x86_64-linux-gnu";
|
||||||
url = "https://github.com/espressif/llvm-project/releases/download/esp-${version}/clang-esp-${version}-x86_64-linux-gnu.tar.xz";
|
binhash = "aee15b8e02440f9ec6a8070f017621dc400dbd62a4701f9cf456dbe34d2a0c4d";
|
||||||
sha256 = "0k8c596y7nsnyjf1yw54cayhsh6w45v023q7m339w3s40a75pqdf";
|
libhash = "cfd6fcb41d6d3651e3e7bdbb37d0e0b691b43e680dff4c998cf77f7e4ecd05c5";
|
||||||
})
|
};
|
||||||
(builtins.fetchurl
|
"x86_64-darwin" = {
|
||||||
{
|
system = "x86_64-apple-darwin";
|
||||||
url = "https://github.com/espressif/llvm-project/releases/download/esp-${version}/libs-clang-esp-${version}-x86_64-linux-gnu.tar.xz";
|
binhash = "b4641ec4dd574b6b7d037aa1bb2e5ff5a8a4623c88e89668db656282eb1d9dc8";
|
||||||
sha256 = "1i85rm77wzzpijclrzqdd0zb94dnw383gfxxwzim2dkd3nsgrmng";
|
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;
|
preferLocalBuild = true;
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
autoPatchelfHook
|
autoPatchelfHook
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
stdenv.cc.cc.lib
|
stdenv.cc.cc.lib
|
||||||
libz
|
libz
|
||||||
libxml2
|
libxml2
|
||||||
];
|
];
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p "$out"
|
mkdir -p "$out"
|
||||||
cp -R ./{bin,share,lib,include} "$out"
|
cp -R ./{bin,share,lib,include} "$out"
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
34
flake.lock
34
flake.lock
@ -1,5 +1,23 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1710146030,
|
||||||
|
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1725983898,
|
"lastModified": 1725983898,
|
||||||
@ -18,8 +36,24 @@
|
|||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
26
flake.nix
26
flake.nix
@ -3,19 +3,23 @@
|
|||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs = {
|
||||||
self,
|
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
}: let
|
flake-utils,
|
||||||
system = "x86_64-linux";
|
...
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
}:
|
||||||
in {
|
flake-utils.lib.eachDefaultSystem (
|
||||||
packages.${system} = {
|
system: let
|
||||||
rust = import ./rust.nix {inherit pkgs;};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
clang = import ./clang.nix {inherit pkgs;};
|
in {
|
||||||
default = self.packages.${system}.rust;
|
packages = rec {
|
||||||
};
|
rust = import ./rust.nix {inherit pkgs system;};
|
||||||
};
|
clang = import ./clang.nix {inherit pkgs system;};
|
||||||
|
default = rust;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
87
rust.nix
87
rust.nix
@ -1,36 +1,59 @@
|
|||||||
{pkgs ? import <nixpkgs> {}}:
|
{
|
||||||
pkgs.stdenv.mkDerivation rec {
|
pkgs ? import <nixpkgs> {},
|
||||||
pname = "esp-rust";
|
system ? builtins.currentSystem,
|
||||||
version = "1.81.0";
|
}: let
|
||||||
srcs = [
|
systems_table = {
|
||||||
(builtins.fetchurl
|
"x86_64-linux" = {
|
||||||
{
|
system = "x86_64-unknown-linux-gnu";
|
||||||
url = "https://github.com/esp-rs/rust-build/releases/download/v${version}.0/rust-${version}.0-x86_64-unknown-linux-gnu.tar.xz";
|
hash = "1pilzw6lqygysdrklzs64vb07a3ni0pw24qklkwc5gjqwgzc4ka4";
|
||||||
sha256 = "1pilzw6lqygysdrklzs64vb07a3ni0pw24qklkwc5gjqwgzc4ka4";
|
};
|
||||||
})
|
"x86_64-darwin" = {
|
||||||
(builtins.fetchurl
|
system = "x86_64-apple-darwin";
|
||||||
{
|
hash = "09j72xspg1bq82hk9w9ij9h17yk4lr0wfv20ybm1pah4bfxw6mha";
|
||||||
url = "https://github.com/esp-rs/rust-build/releases/download/v${version}.0/rust-src-${version}.0.tar.xz";
|
};
|
||||||
sha256 = "0w7fy0biml8ddvwpmrn9js4x6vkqjhm118gxy2431fnxl97v947f";
|
"aarch64-linux" = {
|
||||||
})
|
system = "aarch64-unknown-linux-gnu";
|
||||||
];
|
hash = "170013pw7rllqzc03i39xrwy486jllxjjh53sgnywqz0ylycx7j8";
|
||||||
sourceRoot = ".";
|
};
|
||||||
|
"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}.0/rust-src-${version}.tar.xz";
|
||||||
|
sha256 = "0w7fy0biml8ddvwpmrn9js4x6vkqjhm118gxy2431fnxl97v947f";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
sourceRoot = ".";
|
||||||
|
|
||||||
preferLocalBuild = true;
|
preferLocalBuild = true;
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
autoPatchelfHook
|
autoPatchelfHook
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
stdenv.cc.cc.lib
|
stdenv.cc.cc.lib
|
||||||
libz
|
libz
|
||||||
];
|
];
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
mkdir -p "$out"
|
mkdir -p "$out"
|
||||||
cp -R ./*/*/{bin,share,lib} "$out"
|
cp -R ./*/*/{bin,share,lib} "$out"
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user