1
0
Fork 0
mirror of https://github.com/mitchellh/zig-overlay.git synced 2025-05-08 18:46:02 +03:00
This commit is contained in:
Mikołaj Lercher 2025-04-07 11:36:52 +02:00 committed by GitHub
commit 3309fc70ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 428 additions and 7434 deletions

7
.gitignore vendored
View file

@ -1,4 +1,9 @@
index.json
index.json.minisig
zig-index.json
zig-index.json.minisig
mach-index.json
sources.old.json
sources.new.json
.direnv
result

View file

@ -43,6 +43,8 @@ $ nix run 'github:mitchellh/zig-overlay'
$ nix shell 'github:mitchellh/zig-overlay#master-2021-02-13'
# open a shell with latest nightly version
$ nix shell 'github:mitchellh/zig-overlay#master'
# open a shell with latest Mach nominated version
$ nix shell 'github:mitchellh/zig-overlay#mach-latest'
```
### Compiler Development

View file

@ -33,8 +33,12 @@
lib.attrsets.mapAttrs
(k: v: mkBinaryInstall {inherit (v.${system}) version url sha256;})
(lib.attrsets.filterAttrs
(k: v: (builtins.hasAttr system v) && (v.${system}.url != null) && (v.${system}.sha256 != null))
(builtins.removeAttrs sources ["master"]));
(k: v:
(builtins.hasAttr system v)
&& (v.${system}.url != null)
&& (v.${system}.sha256 != null)
&& !(lib.strings.hasSuffix "mach" k))
(builtins.removeAttrs sources ["master" "mach-latest"]));
# The master packages
masterPackages =
@ -52,13 +56,34 @@
(k: v: (builtins.hasAttr system v) && (v.${system}.url != null))
sources.master);
# Mach nominated versions
# https://machengine.org/docs/nominated-zig/
machPackages =
lib.attrsets.mapAttrs
(k: v: mkBinaryInstall {inherit (v.${system}) version url sha256;})
(lib.attrsets.filterAttrs (k: v: lib.strings.hasSuffix "mach" k)
(builtins.removeAttrs sources ["master"]));
# This determines the latest /released/ version.
latest = lib.lists.last (
builtins.sort
(x: y: (builtins.compareVersions x y) < 0)
(builtins.attrNames taggedPackages)
);
# Latest Mach nominated version
machLatest = lib.lists.last (
builtins.sort
(x: y: (builtins.compareVersions x y) < 0)
(builtins.attrNames machPackages)
);
in
# We want the packages but also add a "default" that just points to the
# latest released version.
taggedPackages // masterPackages // {"default" = taggedPackages.${latest};}
taggedPackages
// masterPackages
// machPackages
// {
"default" = taggedPackages.${latest};
mach-latest = machPackages.${machLatest};
}

File diff suppressed because it is too large Load diff

16
update
View file

@ -6,14 +6,18 @@ set -e
PUBLIC_KEY="RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U"
# Grab the JSON and parse the version
rm -rf index.json index.json.minisig
curl -s 'https://ziglang.org/download/index.json' > index.json
VERSION=$(cat index.json | jq -r '.master.version')
rm -rf *index.json zig-index.json.minisig
curl -s 'https://ziglang.org/download/index.json' > zig-index.json
VERSION=$(cat zig-index.json | jq -r '.master.version')
echo "Parsing master version: ${VERSION}"
# Verify the signature of the JSON before we parse it
curl -s "https://ziglang.org/builds/zig-${VERSION}-index.json.minisig" > index.json.minisig
minisign -V -P ${PUBLIC_KEY} -x index.json.minisig -m index.json
curl -s "https://ziglang.org/builds/zig-${VERSION}-index.json.minisig" > zig-index.json.minisig
minisign -V -P ${PUBLIC_KEY} -x zig-index.json.minisig -m zig-index.json
# Merge Mach's index.json with the official one
curl -s 'https://machengine.org/zig/index.json' > mach-index.json
jq -s '.[0] * .[1]' mach-index.json zig-index.json > index.json
# Build our new sources.json
cat index.json | jq '
@ -35,7 +39,7 @@ def toentry(vsn; x):
reduce to_entries[] as $entry ({}; . * (
$entry | {
(.key): (
if (.key != "master") then
if (.key != "master" and .key != "mach-latest") then
toentry(.key; .value)
else {
"latest": toentry(.value.version; .value),