Merge branch 'main' into clerie/arduino-env
This commit is contained in:
22
README.md
22
README.md
@@ -16,16 +16,8 @@ From the indexes you create overlays which then make the Arduino packages and li
|
|||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
arduino-nix.url = "github:bouk/arduino-nix";
|
arduino-nix.url = "github:bouk/arduino-nix";
|
||||||
arduino-library-index = {
|
arduino-index = {
|
||||||
url = "github:bouk/arduino-indexes/library_index";
|
url = "github:bouk/arduino-indexes";
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
arduino-package-index = {
|
|
||||||
url = "github:bouk/arduino-indexes/package_index";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
arduino-package-rp2040-index = {
|
|
||||||
url = "github:bouk/arduino-indexes/package_rp2040_index";
|
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -35,17 +27,15 @@ From the indexes you create overlays which then make the Arduino packages and li
|
|||||||
nixpkgs,
|
nixpkgs,
|
||||||
flake-utils,
|
flake-utils,
|
||||||
arduino-nix,
|
arduino-nix,
|
||||||
arduino-package-index,
|
arduino-index,
|
||||||
arduino-package-rp2040-index,
|
|
||||||
arduino-library-index,
|
|
||||||
...
|
...
|
||||||
}@attrs:
|
}@attrs:
|
||||||
let
|
let
|
||||||
overlays = [
|
overlays = [
|
||||||
(arduino-nix.overlay)
|
(arduino-nix.overlay)
|
||||||
(arduino-nix.mkArduinoPackageOverlay (arduino-package-index + "/package_index.json"))
|
(arduino-nix.mkArduinoPackageOverlay (arduino-index + "/index/package_index.json"))
|
||||||
(arduino-nix.mkArduinoPackageOverlay (arduino-package-rp2040-index + "/package_rp2040_index.json"))
|
(arduino-nix.mkArduinoPackageOverlay (arduino-index + "/index/package_rp2040_index.json"))
|
||||||
(arduino-nix.mkArduinoLibraryOverlay (arduino-library-index + "/library_index.json"))
|
(arduino-nix.mkArduinoLibraryOverlay (arduino-index + "/index/library_index.json"))
|
||||||
(arduino-nix.mkArduinoPackageOverlay (pkgs.fetchurl {
|
(arduino-nix.mkArduinoPackageOverlay (pkgs.fetchurl {
|
||||||
url = "https://raw.githubusercontent.com/espressif/arduino-esp32/8bae7e23376c6087a55e46456049ae6d73b72e16/package_esp32_index.json";
|
url = "https://raw.githubusercontent.com/espressif/arduino-esp32/8bae7e23376c6087a55e46456049ae6d73b72e16/package_esp32_index.json";
|
||||||
hash = "sha256-0kvZeRDtE/JKJes86omyN4cf4HWfX68P7xPfE+BvTC8=";
|
hash = "sha256-0kvZeRDtE/JKJes86omyN4cf4HWfX68P7xPfE+BvTC8=";
|
||||||
|
|||||||
6
lib.nix
6
lib.nix
@@ -27,9 +27,11 @@ with builtins; rec {
|
|||||||
else if system == "i686-darwin" then
|
else if system == "i686-darwin" then
|
||||||
lib.findFirst ({host, ...}: (match "i[3456]86-apple-darwin.*" host) != null) null systems
|
lib.findFirst ({host, ...}: (match "i[3456]86-apple-darwin.*" host) != null) null systems
|
||||||
else if system == "aarch64-linux" then
|
else if system == "aarch64-linux" then
|
||||||
lib.findFirst ({host, ...}: (match "(aarch64|arm64)-linux-gnu" host) != null) null systems
|
# tools.go uses regexp.MatchString which will also return true for substring matches, so we add a .* to the regex
|
||||||
|
lib.findFirst ({host, ...}: (match "(aarch64|arm64)-linux-gnu.*" host) != null) null systems
|
||||||
else if system == "x86_64-linux" then
|
else if system == "x86_64-linux" then
|
||||||
lib.findFirst ({host, ...}: (match "x86_64-.*linux-gnu" host) != null) null systems
|
# also add a .* to the regex here though it is not necessary in the current dataset (March 2024)
|
||||||
|
lib.findFirst ({host, ...}: (match "x86_64-.*linux-gnu.*" host) != null) null systems
|
||||||
else null;
|
else null;
|
||||||
convertHash = hash: let
|
convertHash = hash: let
|
||||||
m = (match "(SHA-256|SHA-1|MD5):(.*)" hash);
|
m = (match "(SHA-256|SHA-1|MD5):(.*)" hash);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ let
|
|||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
nativeBuildInputs = [ pkgs.unzip ];
|
nativeBuildInputs = [ pkgs.unzip ];
|
||||||
src = fetchurl ({
|
src = pkgs.fetchurl ({
|
||||||
url = url;
|
url = url;
|
||||||
} // (convertHash checksum));
|
} // (convertHash checksum));
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ let
|
|||||||
cp -R * "$out/$dirName/"
|
cp -R * "$out/$dirName/"
|
||||||
'';
|
'';
|
||||||
nativeBuildInputs = [ pkgs.unzip ];
|
nativeBuildInputs = [ pkgs.unzip ];
|
||||||
src = fetchurl ({
|
src = pkgs.fetchurl ({
|
||||||
url = system.url;
|
url = system.url;
|
||||||
} // (convertHash system.checksum));
|
} // (convertHash system.checksum));
|
||||||
};
|
};
|
||||||
@@ -58,7 +58,7 @@ let
|
|||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
nativeBuildInputs = [ pkgs.unzip ];
|
nativeBuildInputs = [ pkgs.unzip ];
|
||||||
src = fetchurl ({
|
src = pkgs.fetchurl ({
|
||||||
url = url;
|
url = url;
|
||||||
} // (convertHash checksum));
|
} // (convertHash checksum));
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ let
|
|||||||
(pkgs.writeTextDir "package_index.json" (builtins.toJSON {packages = [];}))
|
(pkgs.writeTextDir "package_index.json" (builtins.toJSON {packages = [];}))
|
||||||
(pkgs.writeTextDir "library_index.json" (builtins.toJSON {libraries = [];}))
|
(pkgs.writeTextDir "library_index.json" (builtins.toJSON {libraries = [];}))
|
||||||
];
|
];
|
||||||
|
postBuild = ''
|
||||||
|
mkdir -p $out/staging
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
pkgs.runCommand "arduino-cli-wrapped" {
|
pkgs.runCommand "arduino-cli-wrapped" {
|
||||||
|
|||||||
Reference in New Issue
Block a user