Add README

This commit is contained in:
Bouke van der Bijl
2022-12-20 18:31:51 +01:00
parent 34bad86b5d
commit 7653e724f3
3 changed files with 89 additions and 14 deletions

15
lib.nix
View File

@@ -4,6 +4,21 @@ let
in
with builtins; rec {
latestVersion = attrs: (builtins.head (builtins.sort (a: b: (builtins.compareVersions a.version b.version) == 1) (builtins.attrValues (builtins.mapAttrs (version: value: { inherit version value; }) attrs)))).value;
# From tools.go in arduino-cli
# regexpLinuxArm = regexp.MustCompile("arm.*-linux-gnueabihf")
# regexpLinuxArm64 = regexp.MustCompile("(aarch64|arm64)-linux-gnu")
# regexpLinux64 = regexp.MustCompile("x86_64-.*linux-gnu")
# regexpLinux32 = regexp.MustCompile("i[3456]86-.*linux-gnu")
# regexpWindows32 = regexp.MustCompile("i[3456]86-.*(mingw32|cygwin)")
# regexpWindows64 = regexp.MustCompile("(amd64|x86_64)-.*(mingw32|cygwin)")
# regexpMac64 = regexp.MustCompile("x86_64-apple-darwin.*")
# regexpMac32 = regexp.MustCompile("i[3456]86-apple-darwin.*")
# regexpMacArm64 = regexp.MustCompile("arm64-apple-darwin.*")
# regexpFreeBSDArm = regexp.MustCompile("arm.*-freebsd[0-9]*")
# regexpFreeBSD32 = regexp.MustCompile("i?[3456]86-freebsd[0-9]*")
# regexpFreeBSD64 = regexp.MustCompile("amd64-freebsd[0-9]*")
selectSystem = system: systems:
if system == "aarch64-darwin" then
alt (lib.findFirst ({host, ...}: (match "arm64-apple-darwin.*" host) != null) null systems) (selectSystem "x86_64-darwin" systems)