initial Commit

This commit is contained in:
Max Känner 2024-09-15 21:15:56 +02:00
commit 2763345291
4 changed files with 116 additions and 0 deletions

34
clang.nix Normal file
View File

@ -0,0 +1,34 @@
{pkgs ? import <nixpkgs> {}}:
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}-x86_64-linux-gnu.tar.xz";
sha256 = "0k8c596y7nsnyjf1yw54cayhsh6w45v023q7m339w3s40a75pqdf";
})
(builtins.fetchurl
{
url = "https://github.com/espressif/llvm-project/releases/download/esp-${version}/libs-clang-esp-${version}-x86_64-linux-gnu.tar.xz";
sha256 = "1i85rm77wzzpijclrzqdd0zb94dnw383gfxxwzim2dkd3nsgrmng";
})
];
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"
'';
}

27
flake.lock Normal file
View File

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1725983898,
"narHash": "sha256-4b3A9zPpxAxLnkF9MawJNHDtOOl6ruL0r6Og1TEDGCE=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "1355a0cbfeac61d785b7183c0caaec1f97361b43",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

19
flake.nix Normal file
View File

@ -0,0 +1,19 @@
{
description = "A flake providing espressifs rust fork for esp32";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = {
self,
nixpkgs,
}: let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in {
packages.x86_64-linux.esp-rust = import ./rust.nix {inherit pkgs;};
packages.x86_64-linux.esp-clang = import ./clang.nix {inherit pkgs;};
packages.x86_64-linux.default = self.packages.x86_64-linux.esp-rust;
};
}

36
rust.nix Normal file
View File

@ -0,0 +1,36 @@
{pkgs ? import <nixpkgs> {}}:
pkgs.stdenv.mkDerivation rec {
pname = "esp-rust";
version = "1.81.0";
srcs = [
(builtins.fetchurl
{
url = "https://github.com/esp-rs/rust-build/releases/download/v${version}.0/rust-${version}.0-x86_64-unknown-linux-gnu.tar.xz";
sha256 = "1pilzw6lqygysdrklzs64vb07a3ni0pw24qklkwc5gjqwgzc4ka4";
})
(builtins.fetchurl
{
url = "https://github.com/esp-rs/rust-build/releases/download/v${version}.0/rust-src-${version}.0.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
'';
}