add esp-idf tooling
This commit is contained in:
		
							
								
								
									
										20
									
								
								esp-idf.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								esp-idf.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| { | ||||
|   pkgs ? import <nixpkgs> {}, | ||||
|   system ? builtins.currentSystem, | ||||
| }: | ||||
| pkgs.stdenv.mkDerivation rec { | ||||
|   pname = "esp-idf"; | ||||
|   version = "5.4"; | ||||
|   src = pkgs.fetchFromGitHub { | ||||
|     owner = "espressif"; | ||||
|     repo = "esp-idf"; | ||||
|     rev = "v${version}"; | ||||
|     fetchSubmodules = true; | ||||
|     hash = "sha256-9OQ/0DGwgfR3MkRWd6zSe1FD3Ywt4Ugw8J/BFu1Vfw0="; | ||||
|   }; | ||||
|  | ||||
|   buildInputs = with pkgs; [ | ||||
|     python3 | ||||
|     libusb1 | ||||
|   ]; | ||||
| } | ||||
							
								
								
									
										21
									
								
								esp-rom-elfs.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								esp-rom-elfs.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| {pkgs}: | ||||
| pkgs.stdenv.mkDerivation rec { | ||||
|   pname = "esp-rom-elfs"; | ||||
|   version = "20241011"; | ||||
|   src = | ||||
|     builtins.fetchurl | ||||
|     { | ||||
|       url = "https://github.com/espressif/${pname}/releases/download/${version}/${pname}-${version}.tar.gz"; | ||||
|       sha256 = "sha256:1ag9z459pgr7rmjxqfl8a6mayjiqffqmbvmzixicf8d4ch0h07wj"; | ||||
|     }; | ||||
|  | ||||
|   preferLocalBuild = true; | ||||
|  | ||||
|   dontUnpack = true; | ||||
|  | ||||
|   installPhase = '' | ||||
|     mkdir -p "$out" | ||||
|     cd "$out" | ||||
|     tar -xf $src | ||||
|   ''; | ||||
| } | ||||
							
								
								
									
										54
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										54
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							| @@ -1,5 +1,21 @@ | ||||
| { | ||||
|   "nodes": { | ||||
|     "flake-compat": { | ||||
|       "flake": false, | ||||
|       "locked": { | ||||
|         "lastModified": 1696426674, | ||||
|         "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", | ||||
|         "owner": "edolstra", | ||||
|         "repo": "flake-compat", | ||||
|         "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", | ||||
|         "type": "github" | ||||
|       }, | ||||
|       "original": { | ||||
|         "owner": "edolstra", | ||||
|         "repo": "flake-compat", | ||||
|         "type": "github" | ||||
|       } | ||||
|     }, | ||||
|     "flake-utils": { | ||||
|       "inputs": { | ||||
|         "systems": "systems" | ||||
| @@ -34,10 +50,46 @@ | ||||
|         "type": "github" | ||||
|       } | ||||
|     }, | ||||
|     "nixpkgs-python": { | ||||
|       "inputs": { | ||||
|         "flake-compat": "flake-compat", | ||||
|         "nixpkgs": "nixpkgs_2" | ||||
|       }, | ||||
|       "locked": { | ||||
|         "lastModified": 1733319315, | ||||
|         "narHash": "sha256-cFQBdRmtIZFVjr2P6NkaCOp7dddF93BC0CXBwFZFaN0=", | ||||
|         "owner": "cachix", | ||||
|         "repo": "nixpkgs-python", | ||||
|         "rev": "01263eeb28c09f143d59cd6b0b7c4cc8478efd48", | ||||
|         "type": "github" | ||||
|       }, | ||||
|       "original": { | ||||
|         "owner": "cachix", | ||||
|         "repo": "nixpkgs-python", | ||||
|         "type": "github" | ||||
|       } | ||||
|     }, | ||||
|     "nixpkgs_2": { | ||||
|       "locked": { | ||||
|         "lastModified": 1719253556, | ||||
|         "narHash": "sha256-A/76RFUVxZ/7Y8+OMVL1Lc8LRhBxZ8ZE2bpMnvZ1VpY=", | ||||
|         "owner": "NixOS", | ||||
|         "repo": "nixpkgs", | ||||
|         "rev": "fc07dc3bdf2956ddd64f24612ea7fc894933eb2e", | ||||
|         "type": "github" | ||||
|       }, | ||||
|       "original": { | ||||
|         "owner": "NixOS", | ||||
|         "ref": "nixos-24.05", | ||||
|         "repo": "nixpkgs", | ||||
|         "type": "github" | ||||
|       } | ||||
|     }, | ||||
|     "root": { | ||||
|       "inputs": { | ||||
|         "flake-utils": "flake-utils", | ||||
|         "nixpkgs": "nixpkgs" | ||||
|         "nixpkgs": "nixpkgs", | ||||
|         "nixpkgs-python": "nixpkgs-python" | ||||
|       } | ||||
|     }, | ||||
|     "systems": { | ||||
|   | ||||
| @@ -4,20 +4,28 @@ | ||||
|   inputs = { | ||||
|     nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; | ||||
|     flake-utils.url = "github:numtide/flake-utils"; | ||||
|     nixpkgs-python.url = "github:cachix/nixpkgs-python"; | ||||
|   }; | ||||
|  | ||||
|   outputs = { | ||||
|     nixpkgs, | ||||
|     nixpkgs-python, | ||||
|     flake-utils, | ||||
|     ... | ||||
|   }: | ||||
|     flake-utils.lib.eachDefaultSystem ( | ||||
|       system: let | ||||
|         pkgs = nixpkgs.legacyPackages.${system}; | ||||
|         pkgs-python = nixpkgs-python.packages.${system}; | ||||
|       in { | ||||
|         packages = rec { | ||||
|           rust = import ./rust.nix {inherit pkgs system;}; | ||||
|           clang = import ./clang.nix {inherit pkgs system;}; | ||||
|           esp-idf = import ./esp-idf.nix {inherit pkgs system;}; | ||||
|           openocd-esp32 = import ./openocd-esp32.nix {inherit pkgs system;}; | ||||
|           xtensa-esp-elf-gdb = import ./xtensa-esp-elf-gdb.nix {inherit pkgs pkgs-python system;}; | ||||
|           xtensa-esp-elf = import ./xtensa-esp-elf.nix {inherit pkgs system;}; | ||||
|           esp-rom-elfs = import ./esp-rom-elfs.nix {inherit pkgs;}; | ||||
|           default = rust; | ||||
|         }; | ||||
|       } | ||||
|   | ||||
							
								
								
									
										38
									
								
								openocd-esp32.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								openocd-esp32.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| { | ||||
|   pkgs, | ||||
|   system, | ||||
| }: let | ||||
|   systems_table = { | ||||
|     "x86_64-linux" = { | ||||
|       system = "linux-amd64"; | ||||
|       hash = "1pw54ja4fmhy4rlaq8hirp5na8xvj5pah2azmnz494n9dl1hyaz8"; | ||||
|     }; | ||||
|   }; | ||||
|   system_download = systems_table.${system}; | ||||
| in | ||||
|   pkgs.stdenv.mkDerivation rec { | ||||
|     pname = "openocd-esp32"; | ||||
|     version = "0.12.0-esp32-20241016"; | ||||
|     src = | ||||
|       builtins.fetchurl | ||||
|       { | ||||
|         url = "https://github.com/espressif/${pname}/releases/download/v${version}/${pname}-${system_download.system}-${version}.tar.gz"; | ||||
|         sha256 = system_download.hash; | ||||
|       }; | ||||
|  | ||||
|     preferLocalBuild = true; | ||||
|  | ||||
|     nativeBuildInputs = with pkgs; [ | ||||
|       autoPatchelfHook | ||||
|     ]; | ||||
|  | ||||
|     buildInputs = with pkgs; [ | ||||
|       systemd | ||||
|       libusb1 | ||||
|     ]; | ||||
|  | ||||
|     installPhase = '' | ||||
|       mkdir -p "$out" | ||||
|       cp -R ./{bin,share} "$out" | ||||
|     ''; | ||||
|   } | ||||
							
								
								
									
										43
									
								
								xtensa-esp-elf-gdb.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								xtensa-esp-elf-gdb.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,43 @@ | ||||
| { | ||||
|   pkgs, | ||||
|   pkgs-python, | ||||
|   system, | ||||
| }: let | ||||
|   systems_table = { | ||||
|     "x86_64-linux" = { | ||||
|       system = "x86_64-linux-gnu"; | ||||
|       hash = "sha256:0g9lk7snccn5464fs1mpyhylmvra0bvn6icqpbsxgixis94l6xqq"; | ||||
|     }; | ||||
|   }; | ||||
|   system_download = systems_table.${system}; | ||||
| in | ||||
|   pkgs.stdenv.mkDerivation rec { | ||||
|     pname = "xtensa-esp-elf-gdb"; | ||||
|     version = "15.2_20241112"; | ||||
|     src = | ||||
|       builtins.fetchurl | ||||
|       { | ||||
|         url = "https://github.com/espressif/binutils-gdb/releases/download/esp-gdb-v${version}/${pname}-${version}-${system_download.system}.tar.gz"; | ||||
|         sha256 = system_download.hash; | ||||
|       }; | ||||
|  | ||||
|     preferLocalBuild = true; | ||||
|  | ||||
|     nativeBuildInputs = with pkgs; [ | ||||
|       autoPatchelfHook | ||||
|     ]; | ||||
|  | ||||
|     buildInputs = with pkgs; [ | ||||
|       pkgs-python."3.8" | ||||
|       pkgs-python."3.9" | ||||
|       pkgs-python."3.10" | ||||
|       pkgs-python."3.11" | ||||
|       pkgs-python."3.12" | ||||
|       pkgs-python."3.13" | ||||
|     ]; | ||||
|  | ||||
|     installPhase = '' | ||||
|       mkdir -p "$out" | ||||
|       cp -R ./{bin,lib} "$out" | ||||
|     ''; | ||||
|   } | ||||
							
								
								
									
										37
									
								
								xtensa-esp-elf.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								xtensa-esp-elf.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| { | ||||
|   pkgs, | ||||
|   system, | ||||
| }: let | ||||
|   systems_table = { | ||||
|     "x86_64-linux" = { | ||||
|       system = "x86_64-linux-gnu"; | ||||
|       hash = "sha256:1s86y3wss3vp5r6c076gz23hs62rkx1qc6vffjp42md86krrv1di"; | ||||
|     }; | ||||
|   }; | ||||
|   system_download = systems_table.${system}; | ||||
| in | ||||
|   pkgs.stdenv.mkDerivation rec { | ||||
|     pname = "xtensa-esp-elf"; | ||||
|     version = "14.2.0_20241119"; | ||||
|     src = | ||||
|       builtins.fetchurl | ||||
|       { | ||||
|         url = "https://github.com/espressif/crosstool-NG/releases/download/esp-${version}/${pname}-${version}-${system_download.system}.tar.gz"; | ||||
|         sha256 = system_download.hash; | ||||
|       }; | ||||
|  | ||||
|     preferLocalBuild = true; | ||||
|  | ||||
|     nativeBuildInputs = with pkgs; [ | ||||
|       autoPatchelfHook | ||||
|     ]; | ||||
|  | ||||
|     buildInputs = with pkgs; [ | ||||
|       pkgs.stdenv.cc.cc | ||||
|     ]; | ||||
|  | ||||
|     installPhase = '' | ||||
|       mkdir -p "$out" | ||||
|       cp -R ./{bin,lib} "$out" | ||||
|     ''; | ||||
|   } | ||||
		Reference in New Issue
	
	Block a user