diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6313b56 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/.github/workflows/automation.yml b/.github/workflows/automation.yml new file mode 100644 index 0000000..e3d2b6d --- /dev/null +++ b/.github/workflows/automation.yml @@ -0,0 +1,29 @@ +name: automation + +on: + schedule: + - cron: "0 0 * * *" + workflow_dispatch: + +jobs: + automation: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Nix + uses: cachix/install-nix-action@v24 + with: + nix_path: nixpkgs=channel:nixos-unstable + - run: | + nix run .#update-versions > versions.json + nix run .#update-templates + nix run .#test + nix run .#readme > README.md + - uses: test-room-7/action-update-file@v1.8.0 + with: + file-path: | + versions.json + templates/** + README.md + commit-msg: Automatic update + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..90fd1e4 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,18 @@ +name: pr + +on: + pull_request: + +jobs: + automation: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Nix + uses: cachix/install-nix-action@v24 + with: + nix_path: nixpkgs=channel:nixos-unstable + - run: | + nix run .#update-templates + nix run .#test + nix run .#readme diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..feda423 --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +# This file is for zig-specific build artifacts. +# If you have OS-specific or editor-specific files to ignore, +# such as *.swp or .DS_Store, put those in your global +# ~/.gitignore and put this in your ~/.gitconfig: +# +# [core] +# excludesfile = ~/.gitignore +# +# Cheers! +# -andrewrk + +zig-cache/ +zig-out/ +/release/ +/debug/ +/build/ +/build-*/ +/docgen_tmp/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c4006d0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (Expat) + +Copyright (c) 2024 Vetoniemi Jari Juhani + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..2143ce0 --- /dev/null +++ b/README.md @@ -0,0 +1,239 @@ +# zig2nix flake + +Flake for packaging, building and running Zig projects. + +https://ziglang.org/ + +--- + +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) + +* Zig master: `0.12.0-dev.2139+e025ad7b4 @ 2024-01-10` +* Zig default: `0.11.0 @ 2023-08-04` + +## Zig project template + +```bash +nix flake init -t github:Cloudef/zig2nix +nix run . +# for more options check the flake.nix file +``` + +### With master version of Zig + +```bash +nix flake init -t github:Cloudef/zig2nix#master +nix run . +# for more options check the flake.nix file +``` + +## Running zig compiler directly + +```bash +nix run github:Cloudef/zig2nix -- version +``` + +## Shell for building and running a Zig project + +```bash +nix develop github:Cloudef/zig2nix +``` + +## Crude documentation + +Below is auto-generated dump of important outputs in this flake. + +```nix +#! Structures. + +#: Helper function for building and running Zig projects. +zig-env = { + # Overrideable nixpkgs. + pkgs ? _pkgs, + # Zig version to use. Normally there is no need to change this. + zig ? zigv.default, + # Additional runtime deps to inject into the helpers. + customRuntimeDeps ? [], + # Additional runtime libs to inject to the helpers. + # Gets included in LD_LIBRARY_PATH and DYLD_LIBRARY_PATH. + customRuntimeLibs ? [], + # Custom prelude in the flake app helper. + customAppHook ? "", + # Custom prelude in the flake shell helper. + customDevShellHook ? "", + # Enable Wayland support. + enableWayland ? false, + # Enable X11 support. + enableX11 ? false, +}: {}; + +#! --- Outputs of zig-env {} function. +#! access: (zig-env {}).thing + +#! Inherit given pkgs and zig version +inherit pkgs zig; + +#: Flake app helper (Without zig-env and root dir restriction). +app-bare-no-root = deps: script: { + type = "app"; + program = toString (pkgs.writeShellApplication { + name = "app"; + runtimeInputs = [] ++ deps; + text = '' + # shellcheck disable=SC2059 + error() { printf -- "error: $1" "''${@:1}" 1>&2; exit 1; } + ${script} + ''; +}; + +#! Flake app helper (Without zig-env). +app-bare = deps: script: app-bare-no-root deps + +#! Flake app helper (without root dir restriction). +app-no-root = deps: script: app-bare-no-root (deps ++ _deps) + +#! Flake app helper. +app = deps: script: app-bare (deps ++ _deps) + +#: Creates dev shell. +shell = pkgs.mkShell { + buildInputs = _deps; + shellHook = _extraShell; +}; + +#! Packages zig project. +#! NOTE: If your project has build.zig.zon you must first generate build.zig.zon.nix using zon2nix. +#! It is recommended to commit the build.zig.zon.nix to your repo. +#! +package = attrs: let + +#! --- Architecture dependent flake outputs. +#! access: `zig2nix.outputs.thing.${system}` + +#! Helper function for building and running Zig projects. +inherit zig-env; + +#! Versioned Zig packages. +packages.zig = zigv; + +#! zon2json: Converts zon files to json +packages.zon2json = zon2json; + +#! zon2nix: Converts build.zig.zon files to nix +packages.zon2nix = zon2nix; + +#! Default zig package. +#! Latest released zig. +packages.default = zigv.default; + +#! Run zon2json +apps.zon2json = app-no-root [zon2json] ''zon2json "$@"''; + +#! Run zon2nix +apps.zon2nix = app-no-root [zon2nix] ''zon2nix "$@"''; + +#! Run a version of a Zig compiler inside a `zig-env`. +#! nix run#zig."zig-version" +#! example: nix run#zig.master +apps.zig = mapAttrs (k: v: (zig-env {zig = v;}).app-no-root [] ''zig "$@"'') zigv; + +#! Run a version of a Zig compiler inside a `zig-env` (With Wayland support). +#! nix run#zig-wayland."zig-version" +#! example: nix run#zig-wayland.master +apps.zig-wayland = mapAttrs (k: v: (zig-env {zig = v; enableWayland = true;}).app-no-root [] ''zig "$@"'') zigv; + +#! Run a version of a Zig compiler inside a `zig-env` (With X11 support). +#! nix run#zig-x11."zig-version" +#! example: nix run#zig-x11.master +apps.zig-x11 = mapAttrs (k: v: (zig-env {zig = v; enableX11 = true;}).app-no-root [] ''zig "$@"'') zigv; + +#! Run a latest released version of a Zig compiler inside a `zig-env`. +#! nix run +apps.default = apps.zig.default; + +#! Develop shell for building and running Zig projects. +#! nix develop#zig."zig-version" +#! example: nix develop#zig.master +devShells.zig = mapAttrs (k: v: (zig-env {zig = v;}).shell) zigv; + +#! Develop shell for building and running Zig projects. (With Wayland support) +#! nix develop#zig-wayland."zig-version" +#! example: nix develop#zig-wayland.master +devShells.zig-wayland = mapAttrs (k: v: (zig-env {zig = v; enableWayland = true;}).shell) zigv; + +#! Develop shell for building and running Zig projects. (With X11 support) +#! nix develop#zig-x11."zig-version" +#! example: nix develop#zig-x11.master +devShells.zig-x11 = mapAttrs (k: v: (zig-env {zig = v; enableX11 = true;}).shell) zigv; + +#! Develop shell for building and running Zig projects. +#! Uses latest released version of Zig. +#! nix develop +devShells.default = devShells.zig.default; + +#! Develop shell for building and running Zig projects (with Wayland support). +#! Uses latest released version of Zig. +#! nix develop +devShells.wayland = devShells.zig-wayland.default; + +#! Develop shell for building and running Zig projects (with X11 support). +#! Uses latest released version of Zig. +#! nix develop +devShells.x11 = devShells.zig-x11.default; + +#! --- Generic flake outputs. +#! access: `zig2nix.outputs.thing` + +#: Overlay for overriding Zig with specific version. +overlays.zig = mapAttrs (k: v: (final: prev: { + zig = v; + zon2json = outputs.packages.zon2json; + zon2nix = outputs.packages.zon2nix; +}; + +#: mitchellh/zig-overlay compatible overlay. +overlays.zig-overlay = final: prev: { + zigpkgs = outputs.packages.${prev.system}.zig; +}; + +#! Default overlay +overlays.default = overlays.zig.default; + +#: Default project template +#: nix flake init -t templates +templates.default = rec { + path = ./templates/default; + description = "Default Zig project template"; + welcomeText = '' + # ${description} + - Zig: https://ziglang.org/ + + ## Build & Run + + --- + nix run . + --- + + See flake.nix for more options. + ''; +}; + +#: Master project template +#: nix flake init -t templates +templates.master = rec { + path = ./templates/master; + description = "Master Zig project template"; + welcomeText = '' + # ${description} + - Zig: https://ziglang.org/ + + ## Build & Run + + --- + nix run . + --- + + See flake.nix for more options. + ''; +}; +``` diff --git a/doc.awk b/doc.awk new file mode 100644 index 0000000..3e40d4c --- /dev/null +++ b/doc.awk @@ -0,0 +1,42 @@ +/#!/ { + gsub(/^[ \t]+/, "", $0) + print($0); + P = 1; + next; +} + +P == 1 { + gsub(/^[ \t]+/, "", $0) + print($0); + if (length($0) > 0) { + print(""); + } + P = 0; +} + +/#:/ { + PP = 1; +} + +PP == 1 && /^[ \t]*}.*[:;]/ { + gsub(/^[ \t]+/, "", $0); + if (substr($0, 0, 2) == "}:") { + print("}: {};\n"); + } else { + print("};\n"); + } + PP = 0 + INDENT -= (INDENT > 0); +} + +PP == 1 { + gsub(/^[ \t]+/, "", $0); + if (INDENT) { + print(" ", $0); + } else { + print($0); + } +} + +PP == 1 && /{/ { INDENT += 1; } +INDENT > 0 && /}/ { INDENT -= 1; } diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..5876418 --- /dev/null +++ b/flake.lock @@ -0,0 +1,60 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1704941647, + "narHash": "sha256-88XxQ6LO3rB/pxJWJir+2xbtEgMWLIKLRmE5dfKRRQs=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "7370e0226d98bf82e3a9f6d992d5388fdcad7d7c", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ce76474 --- /dev/null +++ b/flake.nix @@ -0,0 +1,450 @@ +{ + description = "zig2nix flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { flake-utils, nixpkgs, ... }: with builtins; let + outputs = (flake-utils.lib.eachDefaultSystem (system: let + _pkgs = nixpkgs.outputs.legacyPackages.${system}; + + #! Structures. + + # Zig versions. + # + zigv = import ./versions.nix { + inherit system; + pkgs = _pkgs; + }; + + # Converts zon files to json + zon2json = import tools/zon2json/default.nix { + pkgs = _pkgs; + zig = zigv.master; + }; + + # Converts build.zig.zon to nix + zon2nix = _pkgs.writeShellApplication { + name = "zon2nix"; + runtimeInputs = with _pkgs; [ curl coreutils jq zon2json zigv.master ]; + text = '' + if [[ ! -f "''${1:-build.zig.zon}" ]]; then + printf -- "error: file does not exist: %s" "''${1:-build.zig.zon}" 1>&2 + exit 1 + fi + + read -r zig_cache < <(zig env | jq -r '.global_cache_dir') + + zon2json-recursive() { + zon2json "$1" + while { + read -r url; + read -r zhash; + } do + if [[ ! -d "$zig_cache/p/$zhash" ]]; then + printf -- 'fetching: %s\n' "$url" 1>&2 + zig fetch "$url" 1>/dev/null + fi + if [[ -f "$zig_cache/p/$zhash/build.zig.zon" ]]; then + zon2json-recursive "$zig_cache/p/$zhash/build.zig.zon" + fi + done < <(zon2json "$1" | jq -r '.dependencies | .[] | .url, .hash') + } + + json2nix() { + jq -r '.dependencies | .[] | .url, .hash' | while { + read -r url; + read -r zhash; + }; do + read -r sha256 _ < <(curl -sl "$url" | sha256sum) + cat <&2; exit 1; } + ${script} + ''; + }) + "/bin/app"; + }; + + #! Flake app helper (Without zig-env). + app-bare = deps: script: app-bare-no-root deps '' + [[ -f ./flake.nix ]] || error 'Run this from the project root' + ${script} + ''; + + #! Flake app helper (without root dir restriction). + app-no-root = deps: script: app-bare-no-root (deps ++ _deps) '' + ${_extraApp} + ${script} + ''; + + #! Flake app helper. + app = deps: script: app-bare (deps ++ _deps) '' + ${_extraApp} + ${script} + ''; + + #: Creates dev shell. + shell = pkgs.mkShell { + buildInputs = _deps; + shellHook = _extraShell; + }; + + #! Packages zig project. + #! NOTE: If your project has build.zig.zon you must first generate build.zig.zon.nix using zon2nix. + #! It is recommended to commit the build.zig.zon.nix to your repo. + #! + package = attrs: let + build-zig-zon-path = if attrs ? build-zig-zon then attrs.build-zig-zon else "${attrs.src}/build.zig.zon"; + has-build-zig-zon = pathExists build-zig-zon-path; + has-build-zig-zon-nix = pathExists "${build-zig-zon-path}.nix"; + build-zig-zon = fromJSON (readFile (pkgs.runCommandLocal "build.zig.zon.json" {} '' + ${zon2json}/bin/zon2json "${build-zig-zon-path}" > "$out" + '')); + in pkgs.stdenvNoCC.mkDerivation (lib.optionalAttrs (has-build-zig-zon) { + pname = build-zig-zon.name; + version = build-zig-zon.version; + } // attrs // { + nativeBuildInputs = [ zig.hook ] ++ lib.optionals (attrs ? nativeBuildInputs) attrs.nativeBuildInputs; + postPatch = lib.optionalString (attrs ? postPatch) attrs.postPatch + + lib.optionalString (has-build-zig-zon-nix) '' + ln -s ${pkgs.callPackage "${build-zig-zon-path}.nix" {}} "$ZIG_GLOBAL_CACHE_DIR"/p + ''; + }); + }; + + # Default zig env used by this flake + env = zig-env {}; + app = env.app-bare; + app-no-root = env.app-no-root; + in rec { + #! --- Architecture dependent flake outputs. + #! access: `zig2nix.outputs.thing.${system}` + + #! Helper function for building and running Zig projects. + inherit zig-env; + + #! Versioned Zig packages. + packages.zig = zigv; + + #! zon2json: Converts zon files to json + packages.zon2json = zon2json; + + #! zon2nix: Converts build.zig.zon files to nix + packages.zon2nix = zon2nix; + + #! Default zig package. + #! Latest released zig. + packages.default = zigv.default; + + #! Run zon2json + apps.zon2json = app-no-root [zon2json] ''zon2json "$@"''; + + #! Run zon2nix + apps.zon2nix = app-no-root [zon2nix] ''zon2nix "$@"''; + + #! Run a version of a Zig compiler inside a `zig-env`. + #! nix run#zig."zig-version" + #! example: nix run#zig.master + apps.zig = mapAttrs (k: v: (zig-env {zig = v;}).app-no-root [] ''zig "$@"'') zigv; + + #! Run a version of a Zig compiler inside a `zig-env` (With Wayland support). + #! nix run#zig-wayland."zig-version" + #! example: nix run#zig-wayland.master + apps.zig-wayland = mapAttrs (k: v: (zig-env {zig = v; enableWayland = true;}).app-no-root [] ''zig "$@"'') zigv; + + #! Run a version of a Zig compiler inside a `zig-env` (With X11 support). + #! nix run#zig-x11."zig-version" + #! example: nix run#zig-x11.master + apps.zig-x11 = mapAttrs (k: v: (zig-env {zig = v; enableX11 = true;}).app-no-root [] ''zig "$@"'') zigv; + + #! Run a latest released version of a Zig compiler inside a `zig-env`. + #! nix run + apps.default = apps.zig.default; + + #! Develop shell for building and running Zig projects. + #! nix develop#zig."zig-version" + #! example: nix develop#zig.master + devShells.zig = mapAttrs (k: v: (zig-env {zig = v;}).shell) zigv; + + #! Develop shell for building and running Zig projects. (With Wayland support) + #! nix develop#zig-wayland."zig-version" + #! example: nix develop#zig-wayland.master + devShells.zig-wayland = mapAttrs (k: v: (zig-env {zig = v; enableWayland = true;}).shell) zigv; + + #! Develop shell for building and running Zig projects. (With X11 support) + #! nix develop#zig-x11."zig-version" + #! example: nix develop#zig-x11.master + devShells.zig-x11 = mapAttrs (k: v: (zig-env {zig = v; enableX11 = true;}).shell) zigv; + + #! Develop shell for building and running Zig projects. + #! Uses latest released version of Zig. + #! nix develop + devShells.default = devShells.zig.default; + + #! Develop shell for building and running Zig projects (with Wayland support). + #! Uses latest released version of Zig. + #! nix develop + devShells.wayland = devShells.zig-wayland.default; + + #! Develop shell for building and running Zig projects (with X11 support). + #! Uses latest released version of Zig. + #! nix develop + devShells.x11 = devShells.zig-x11.default; + + # nix run .#update-versions + apps.update-versions = with env.pkgs; app [ curl jq ] '' + tmpdir="$(mktemp -d)" + trap 'rm -rf "$tmpdir"' EXIT + curl https://ziglang.org/download/index.json |\ + jq 'with_entries(select(.key != "0.1.1" and .key != "0.2.0" and .key != "0.3.0" and .key != "0.4.0" and .key != "0.5.0" and .key != "0.6.0" and .key != "0.7.0" and .key != "0.7.1"))' > "$tmpdir"/versions.json + jq 'to_entries | {"default": ({"version": .[1].key} + .[1].value)}' "$tmpdir/versions.json" | cat "$tmpdir/versions.json" - | jq -s add + ''; + + # nix run .#update-templates + apps.update-templates = with env.pkgs; app [ coreutils ] '' + rm -rf templates/default + mkdir -p templates/default + sed 's#/[*]SED_ZIG_VER[*]/##' templates/flake.nix > templates/default/flake.nix + cp -f templates/flake.nix templates/default/flake.nix + cp -f .gitignore templates/default/.gitignore + cp -f .gitattributes templates/default/.gitattributes + (cd templates/default; ${packages.zig.default}/bin/zig init || ${packages.zig.default}/bin/zig init-exe) + + rm -rf templates/master + mkdir -p templates/master + # shellcheck disable=SC2016 + sed 's#/[*]SED_ZIG_VER[*]/# zig = zig2nix.outputs.packages.''${system}.zig.master; #' templates/flake.nix > templates/master/flake.nix + cp -f .gitignore templates/master/.gitignore + cp -f .gitattributes templates/master/.gitattributes + (cd templates/master; ${packages.zig.master}/bin/zig init) + ''; + + # nix run .#test + apps.test = app [] '' + (cd templates/default; nix run --override-input zig2nix ../.. .) + (cd templates/default; nix run --override-input zig2nix ../.. .#test) + (cd templates/default; nix build --override-input zig2nix ../.. .) + rm -f templates/default/result + rm -rf templates/default/zig-out + rm -rf templates/default/zig-cache + (cd templates/master; nix run --override-input zig2nix ../.. .) + (cd templates/master; nix run --override-input zig2nix ../.. .#test) + (cd templates/master; nix build --override-input zig2nix ../.. .) + rm -f templates/master/result + rm -rf templates/master/zig-out + rm -rf templates/master/zig-cache + ''; + + # nix run .#readme + apps.readme = let + project = "zig2nix flake"; + in with env.pkgs; app [ gawk jq ] (replaceStrings ["`"] ["\\`"] '' + cat <$confnix + trap "rm $confnix" EXIT + nix repl $confnix + ''; + }; + })); + in outputs // rec { + #! --- Generic flake outputs. + #! access: `zig2nix.outputs.thing` + + #: Overlay for overriding Zig with specific version. + overlays.zig = mapAttrs (k: v: (final: prev: { + zig = v; + zon2json = outputs.packages.zon2json; + zon2nix = outputs.packages.zon2nix; + })) outputs.packages.${prev.system}.zig; + + #: mitchellh/zig-overlay compatible overlay. + overlays.zig-overlay = final: prev: { + zigpkgs = outputs.packages.${prev.system}.zig; + }; + + #! Default overlay + overlays.default = overlays.zig.default; + + #: Default project template + #: nix flake init -t templates + templates.default = rec { + path = ./templates/default; + description = "Default Zig project template"; + welcomeText = '' + # ${description} + - Zig: https://ziglang.org/ + + ## Build & Run + + ``` + nix run . + ``` + + See flake.nix for more options. + ''; + }; + + #: Master project template + #: nix flake init -t templates + templates.master = rec { + path = ./templates/master; + description = "Master Zig project template"; + welcomeText = '' + # ${description} + - Zig: https://ziglang.org/ + + ## Build & Run + + ``` + nix run . + ``` + + See flake.nix for more options. + ''; + }; + }; +} diff --git a/templates/default/.gitattributes b/templates/default/.gitattributes new file mode 100644 index 0000000..6313b56 --- /dev/null +++ b/templates/default/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/templates/default/.gitignore b/templates/default/.gitignore new file mode 100644 index 0000000..feda423 --- /dev/null +++ b/templates/default/.gitignore @@ -0,0 +1,18 @@ +# This file is for zig-specific build artifacts. +# If you have OS-specific or editor-specific files to ignore, +# such as *.swp or .DS_Store, put those in your global +# ~/.gitignore and put this in your ~/.gitconfig: +# +# [core] +# excludesfile = ~/.gitignore +# +# Cheers! +# -andrewrk + +zig-cache/ +zig-out/ +/release/ +/debug/ +/build/ +/build-*/ +/docgen_tmp/ diff --git a/templates/default/build.zig b/templates/default/build.zig new file mode 100644 index 0000000..1e7dade --- /dev/null +++ b/templates/default/build.zig @@ -0,0 +1,70 @@ +const std = @import("std"); + +// Although this function looks imperative, note that its job is to +// declaratively construct a build graph that will be executed by an external +// runner. +pub fn build(b: *std.Build) void { + // Standard target options allows the person running `zig build` to choose + // what target to build for. Here we do not override the defaults, which + // means any target is allowed, and the default is native. Other options + // for restricting supported target set are available. + const target = b.standardTargetOptions(.{}); + + // Standard optimization options allow the person running `zig build` to select + // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. Here we do not + // set a preferred release mode, allowing the user to decide how to optimize. + const optimize = b.standardOptimizeOption(.{}); + + const exe = b.addExecutable(.{ + .name = "default", + // In this case the main source file is merely a path, however, in more + // complicated build scripts, this could be a generated file. + .root_source_file = .{ .path = "src/main.zig" }, + .target = target, + .optimize = optimize, + }); + + // This declares intent for the executable to be installed into the + // standard location when the user invokes the "install" step (the default + // step when running `zig build`). + b.installArtifact(exe); + + // This *creates* a Run step in the build graph, to be executed when another + // step is evaluated that depends on it. The next line below will establish + // such a dependency. + const run_cmd = b.addRunArtifact(exe); + + // By making the run step depend on the install step, it will be run from the + // installation directory rather than directly from within the cache directory. + // This is not necessary, however, if the application depends on other installed + // files, this ensures they will be present and in the expected location. + run_cmd.step.dependOn(b.getInstallStep()); + + // This allows the user to pass arguments to the application in the build + // command itself, like this: `zig build run -- arg1 arg2 etc` + if (b.args) |args| { + run_cmd.addArgs(args); + } + + // This creates a build step. It will be visible in the `zig build --help` menu, + // and can be selected like this: `zig build run` + // This will evaluate the `run` step rather than the default, which is "install". + const run_step = b.step("run", "Run the app"); + run_step.dependOn(&run_cmd.step); + + // Creates a step for unit testing. This only builds the test executable + // but does not run it. + const unit_tests = b.addTest(.{ + .root_source_file = .{ .path = "src/main.zig" }, + .target = target, + .optimize = optimize, + }); + + const run_unit_tests = b.addRunArtifact(unit_tests); + + // Similar to creating the run step earlier, this exposes a `test` step to + // the `zig build --help` menu, providing a way for the user to request + // running the unit tests. + const test_step = b.step("test", "Run unit tests"); + test_step.dependOn(&run_unit_tests.step); +} diff --git a/templates/default/flake.nix b/templates/default/flake.nix new file mode 100644 index 0000000..19cd94b --- /dev/null +++ b/templates/default/flake.nix @@ -0,0 +1,36 @@ +{ + description = "Zig project flake"; + + inputs = { + zig2nix.url = "github:Cloudef/zig2nix"; + }; + + outputs = { zig2nix, ... }: let + flake-utils = zig2nix.inputs.flake-utils; + in (flake-utils.lib.eachDefaultSystem (system: let + # Zig flake helper + # Check the flake.nix in zig2nix project for more options: + # + env = zig2nix.outputs.zig-env.${system} {/*SED_ZIG_VER*/}; + in { + # nix build . + packages.default = with env.pkgs.lib; env.package ({ + src = ./.; + } // optionalAttrs (!builtins.pathExists ./build.zig.zon) { + pname = "my-zig-project"; + version = "0.0.0"; + }); + + # nix run .# + apps.default = env.app [] "zig build run -- \"$@\""; + + # nix run .#test + apps.test = env.app [] "zig build test -- \"$@\""; + + # nix run .#docs + apps.docs = env.app [] "zig build docs -- \"$@\""; + + # nix develop + devShells.default = env.shell; + })); +} diff --git a/templates/default/src/main.zig b/templates/default/src/main.zig new file mode 100644 index 0000000..c8a3f67 --- /dev/null +++ b/templates/default/src/main.zig @@ -0,0 +1,24 @@ +const std = @import("std"); + +pub fn main() !void { + // Prints to stderr (it's a shortcut based on `std.io.getStdErr()`) + std.debug.print("All your {s} are belong to us.\n", .{"codebase"}); + + // stdout is for the actual output of your application, for example if you + // are implementing gzip, then only the compressed bytes should be sent to + // stdout, not any debugging messages. + const stdout_file = std.io.getStdOut().writer(); + var bw = std.io.bufferedWriter(stdout_file); + const stdout = bw.writer(); + + try stdout.print("Run `zig build test` to run the tests.\n", .{}); + + try bw.flush(); // don't forget to flush! +} + +test "simple test" { + var list = std.ArrayList(i32).init(std.testing.allocator); + defer list.deinit(); // try commenting this out and see if zig detects the memory leak! + try list.append(42); + try std.testing.expectEqual(@as(i32, 42), list.pop()); +} diff --git a/templates/flake.nix b/templates/flake.nix new file mode 100644 index 0000000..19cd94b --- /dev/null +++ b/templates/flake.nix @@ -0,0 +1,36 @@ +{ + description = "Zig project flake"; + + inputs = { + zig2nix.url = "github:Cloudef/zig2nix"; + }; + + outputs = { zig2nix, ... }: let + flake-utils = zig2nix.inputs.flake-utils; + in (flake-utils.lib.eachDefaultSystem (system: let + # Zig flake helper + # Check the flake.nix in zig2nix project for more options: + # + env = zig2nix.outputs.zig-env.${system} {/*SED_ZIG_VER*/}; + in { + # nix build . + packages.default = with env.pkgs.lib; env.package ({ + src = ./.; + } // optionalAttrs (!builtins.pathExists ./build.zig.zon) { + pname = "my-zig-project"; + version = "0.0.0"; + }); + + # nix run .# + apps.default = env.app [] "zig build run -- \"$@\""; + + # nix run .#test + apps.test = env.app [] "zig build test -- \"$@\""; + + # nix run .#docs + apps.docs = env.app [] "zig build docs -- \"$@\""; + + # nix develop + devShells.default = env.shell; + })); +} diff --git a/templates/master/.gitattributes b/templates/master/.gitattributes new file mode 100644 index 0000000..6313b56 --- /dev/null +++ b/templates/master/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/templates/master/.gitignore b/templates/master/.gitignore new file mode 100644 index 0000000..feda423 --- /dev/null +++ b/templates/master/.gitignore @@ -0,0 +1,18 @@ +# This file is for zig-specific build artifacts. +# If you have OS-specific or editor-specific files to ignore, +# such as *.swp or .DS_Store, put those in your global +# ~/.gitignore and put this in your ~/.gitconfig: +# +# [core] +# excludesfile = ~/.gitignore +# +# Cheers! +# -andrewrk + +zig-cache/ +zig-out/ +/release/ +/debug/ +/build/ +/build-*/ +/docgen_tmp/ diff --git a/templates/master/build.zig b/templates/master/build.zig new file mode 100644 index 0000000..60f2034 --- /dev/null +++ b/templates/master/build.zig @@ -0,0 +1,91 @@ +const std = @import("std"); + +// Although this function looks imperative, note that its job is to +// declaratively construct a build graph that will be executed by an external +// runner. +pub fn build(b: *std.Build) void { + // Standard target options allows the person running `zig build` to choose + // what target to build for. Here we do not override the defaults, which + // means any target is allowed, and the default is native. Other options + // for restricting supported target set are available. + const target = b.standardTargetOptions(.{}); + + // Standard optimization options allow the person running `zig build` to select + // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. Here we do not + // set a preferred release mode, allowing the user to decide how to optimize. + const optimize = b.standardOptimizeOption(.{}); + + const lib = b.addStaticLibrary(.{ + .name = "master", + // In this case the main source file is merely a path, however, in more + // complicated build scripts, this could be a generated file. + .root_source_file = .{ .path = "src/root.zig" }, + .target = target, + .optimize = optimize, + }); + + // This declares intent for the library to be installed into the standard + // location when the user invokes the "install" step (the default step when + // running `zig build`). + b.installArtifact(lib); + + const exe = b.addExecutable(.{ + .name = "master", + .root_source_file = .{ .path = "src/main.zig" }, + .target = target, + .optimize = optimize, + }); + + // This declares intent for the executable to be installed into the + // standard location when the user invokes the "install" step (the default + // step when running `zig build`). + b.installArtifact(exe); + + // This *creates* a Run step in the build graph, to be executed when another + // step is evaluated that depends on it. The next line below will establish + // such a dependency. + const run_cmd = b.addRunArtifact(exe); + + // By making the run step depend on the install step, it will be run from the + // installation directory rather than directly from within the cache directory. + // This is not necessary, however, if the application depends on other installed + // files, this ensures they will be present and in the expected location. + run_cmd.step.dependOn(b.getInstallStep()); + + // This allows the user to pass arguments to the application in the build + // command itself, like this: `zig build run -- arg1 arg2 etc` + if (b.args) |args| { + run_cmd.addArgs(args); + } + + // This creates a build step. It will be visible in the `zig build --help` menu, + // and can be selected like this: `zig build run` + // This will evaluate the `run` step rather than the default, which is "install". + const run_step = b.step("run", "Run the app"); + run_step.dependOn(&run_cmd.step); + + // Creates a step for unit testing. This only builds the test executable + // but does not run it. + const lib_unit_tests = b.addTest(.{ + .root_source_file = .{ .path = "src/root.zig" }, + .target = target, + .optimize = optimize, + }); + + const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests); + + const exe_unit_tests = b.addTest(.{ + .root_source_file = .{ .path = "src/main.zig" }, + .target = target, + .optimize = optimize, + }); + + const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests); + + // Similar to creating the run step earlier, this exposes a `test` step to + // the `zig build --help` menu, providing a way for the user to request + // running the unit tests. + const test_step = b.step("test", "Run unit tests"); + test_step.dependOn(&run_lib_unit_tests.step); + test_step.dependOn(&run_exe_unit_tests.step); +} diff --git a/templates/master/build.zig.zon b/templates/master/build.zig.zon new file mode 100644 index 0000000..8085bd1 --- /dev/null +++ b/templates/master/build.zig.zon @@ -0,0 +1,62 @@ +.{ + .name = "master", + // This is a [Semantic Version](https://semver.org/). + // In a future version of Zig it will be used for package deduplication. + .version = "0.0.0", + + // This field is optional. + // This is currently advisory only; Zig does not yet do anything + // with this value. + //.minimum_zig_version = "0.11.0", + + // This field is optional. + // Each dependency must either provide a `url` and `hash`, or a `path`. + // `zig build --fetch` can be used to fetch all dependencies of a package, recursively. + // Once all dependencies are fetched, `zig build` no longer requires + // internet connectivity. + .dependencies = .{ + // See `zig fetch --save ` for a command-line interface for adding dependencies. + //.example = .{ + // // When updating this field to a new URL, be sure to delete the corresponding + // // `hash`, otherwise you are communicating that you expect to find the old hash at + // // the new URL. + // .url = "https://example.com/foo.tar.gz", + // + // // This is computed from the file contents of the directory of files that is + // // obtained after fetching `url` and applying the inclusion rules given by + // // `paths`. + // // + // // This field is the source of truth; packages do not come from a `url`; they + // // come from a `hash`. `url` is just one of many possible mirrors for how to + // // obtain a package matching this `hash`. + // // + // // Uses the [multihash](https://multiformats.io/multihash/) format. + // .hash = "...", + // + // // When this is provided, the package is found in a directory relative to the + // // build root. In this case the package's hash is irrelevant and therefore not + // // computed. This field and `url` are mutually exclusive. + // .path = "foo", + //}, + }, + + // Specifies the set of files and directories that are included in this package. + // Only files and directories listed here are included in the `hash` that + // is computed for this package. + // Paths are relative to the build root. Use the empty string (`""`) to refer to + // the build root itself. + // A directory listed here means that all files within, recursively, are included. + .paths = .{ + // This makes *all* files, recursively, included in this package. It is generally + // better to explicitly list the files and directories instead, to insure that + // fetching from tarballs, file system paths, and version control all result + // in the same contents hash. + "", + // For example... + //"build.zig", + //"build.zig.zon", + //"src", + //"LICENSE", + //"README.md", + }, +} diff --git a/templates/master/flake.nix b/templates/master/flake.nix new file mode 100644 index 0000000..12f7c4a --- /dev/null +++ b/templates/master/flake.nix @@ -0,0 +1,36 @@ +{ + description = "Zig project flake"; + + inputs = { + zig2nix.url = "github:Cloudef/zig2nix"; + }; + + outputs = { zig2nix, ... }: let + flake-utils = zig2nix.inputs.flake-utils; + in (flake-utils.lib.eachDefaultSystem (system: let + # Zig flake helper + # Check the flake.nix in zig2nix project for more options: + # + env = zig2nix.outputs.zig-env.${system} { zig = zig2nix.outputs.packages.${system}.zig.master; }; + in { + # nix build . + packages.default = with env.pkgs.lib; env.package ({ + src = ./.; + } // optionalAttrs (!builtins.pathExists ./build.zig.zon) { + pname = "my-zig-project"; + version = "0.0.0"; + }); + + # nix run .# + apps.default = env.app [] "zig build run -- \"$@\""; + + # nix run .#test + apps.test = env.app [] "zig build test -- \"$@\""; + + # nix run .#docs + apps.docs = env.app [] "zig build docs -- \"$@\""; + + # nix develop + devShells.default = env.shell; + })); +} diff --git a/templates/master/src/main.zig b/templates/master/src/main.zig new file mode 100644 index 0000000..c8a3f67 --- /dev/null +++ b/templates/master/src/main.zig @@ -0,0 +1,24 @@ +const std = @import("std"); + +pub fn main() !void { + // Prints to stderr (it's a shortcut based on `std.io.getStdErr()`) + std.debug.print("All your {s} are belong to us.\n", .{"codebase"}); + + // stdout is for the actual output of your application, for example if you + // are implementing gzip, then only the compressed bytes should be sent to + // stdout, not any debugging messages. + const stdout_file = std.io.getStdOut().writer(); + var bw = std.io.bufferedWriter(stdout_file); + const stdout = bw.writer(); + + try stdout.print("Run `zig build test` to run the tests.\n", .{}); + + try bw.flush(); // don't forget to flush! +} + +test "simple test" { + var list = std.ArrayList(i32).init(std.testing.allocator); + defer list.deinit(); // try commenting this out and see if zig detects the memory leak! + try list.append(42); + try std.testing.expectEqual(@as(i32, 42), list.pop()); +} diff --git a/templates/master/src/root.zig b/templates/master/src/root.zig new file mode 100644 index 0000000..ecfeade --- /dev/null +++ b/templates/master/src/root.zig @@ -0,0 +1,10 @@ +const std = @import("std"); +const testing = std.testing; + +export fn add(a: i32, b: i32) i32 { + return a + b; +} + +test "basic add functionality" { + try testing.expect(add(3, 7) == 10); +} diff --git a/tools/zon2json/LICENSE b/tools/zon2json/LICENSE new file mode 100644 index 0000000..c4006d0 --- /dev/null +++ b/tools/zon2json/LICENSE @@ -0,0 +1,21 @@ +The MIT License (Expat) + +Copyright (c) 2024 Vetoniemi Jari Juhani + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tools/zon2json/build.zig b/tools/zon2json/build.zig new file mode 100644 index 0000000..039401b --- /dev/null +++ b/tools/zon2json/build.zig @@ -0,0 +1,29 @@ +const std = @import("std"); + +pub fn build(b: *std.Build) void { + const target = b.standardTargetOptions(.{}); + const optimize = b.standardOptimizeOption(.{}); + + const exe = b.addExecutable(.{ + .name = "zon2json", + .root_source_file = .{ .path = "src/main.zig" }, + .target = target, + .optimize = optimize, + }); + + b.installArtifact(exe); + const run_cmd = b.addRunArtifact(exe); + run_cmd.step.dependOn(b.getInstallStep()); + if (b.args) |args| run_cmd.addArgs(args); + const run_step = b.step("run", "Run the app"); + run_step.dependOn(&run_cmd.step); + + const exe_unit_tests = b.addTest(.{ + .root_source_file = .{ .path = "src/main.zig" }, + .target = target, + .optimize = optimize, + }); + const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests); + const test_step = b.step("test", "Run unit tests"); + test_step.dependOn(&run_exe_unit_tests.step); +} diff --git a/tools/zon2json/build.zig.zon b/tools/zon2json/build.zig.zon new file mode 100644 index 0000000..b1cc391 --- /dev/null +++ b/tools/zon2json/build.zig.zon @@ -0,0 +1,11 @@ +.{ + .name = "zon2json", + .version = "0.0.0", + .dependencies = .{}, + .paths = .{ + "src", + "build.zig", + "build.zig.zon", + "LICENSE", + }, +} diff --git a/tools/zon2json/default.nix b/tools/zon2json/default.nix new file mode 100644 index 0000000..ecbe7b9 --- /dev/null +++ b/tools/zon2json/default.nix @@ -0,0 +1,11 @@ +{ + pkgs ? import {} + , stdenv ? pkgs.stdenvNoCC + , zig ? pkgs.zig +}: + +stdenv.mkDerivation { + name = "zon2json"; + src = ./.; + nativeBuildInputs = [ zig.hook ]; +} diff --git a/tools/zon2json/src/main.zig b/tools/zon2json/src/main.zig new file mode 100644 index 0000000..173fdb4 --- /dev/null +++ b/tools/zon2json/src/main.zig @@ -0,0 +1,109 @@ +const std = @import("std"); + +fn stringifyFieldName(allocator: std.mem.Allocator, ast: std.zig.Ast, idx: std.zig.Ast.Node.Index) !?[]const u8 { + if (ast.firstToken(idx) < 2) return null; + const slice = ast.tokenSlice(ast.firstToken(idx) - 2); + if (slice[0] == '@') { + const v = try std.zig.string_literal.parseAlloc(allocator, slice[1..]); + defer allocator.free(v); + return try std.json.stringifyAlloc(allocator, v, .{}); + } + return try std.json.stringifyAlloc(allocator, slice, .{}); +} + +fn stringifyValue(allocator: std.mem.Allocator, ast: std.zig.Ast, idx: std.zig.Ast.Node.Index) !?[]const u8 { + const slice = ast.tokenSlice(ast.nodes.items(.main_token)[idx]); + std.log.debug("value: {s}", .{slice}); + if (slice[0] == '\'') { + switch (std.zig.parseCharLiteral(slice)) { + .success => |v| return try std.json.stringifyAlloc(allocator, v, .{}), + .failure => return error.parseCharLiteralFailed, + } + } else if (slice[0] == '"') { + const v = try std.zig.string_literal.parseAlloc(allocator, slice); + defer allocator.free(v); + return try std.json.stringifyAlloc(allocator, v, .{}); + } + switch (std.zig.number_literal.parseNumberLiteral(slice)) { + .int => |v| return try std.json.stringifyAlloc(allocator, v, .{}), + .float => |v| return try std.json.stringifyAlloc(allocator, v, .{}), + .big_int => |v| return try std.json.stringifyAlloc(allocator, v, .{}), + .failure => {}, + } + // literal + return try std.json.stringifyAlloc(allocator, slice, .{}); +} + +fn stringify(allocator: std.mem.Allocator, writer: anytype, ast: std.zig.Ast, idx: std.zig.Ast.Node.Index, has_name: bool) !void { + if (has_name) { + if (try stringifyFieldName(allocator, ast, idx)) |name| { + defer allocator.free(name); + std.log.debug("field: {s}", .{name}); + try writer.print("{s}:", .{name}); + } + } + + var buf: [2]std.zig.Ast.Node.Index = undefined; + if (ast.fullStructInit(&buf, idx)) |v| { + try writer.writeAll("{"); + for (v.ast.fields, 0..) |i, n| { + try stringify(allocator, writer, ast, i, true); + if (n + 1 != v.ast.fields.len) try writer.writeAll(","); + } + try writer.writeAll("}"); + } else if (ast.fullArrayInit(&buf, idx)) |v| { + try writer.writeAll("["); + for (v.ast.elements, 0..) |i, n| { + try stringify(allocator, writer, ast, i, false) ; + if (n + 1 != v.ast.elements.len) try writer.writeAll(","); + } + try writer.writeAll("]"); + } else if (try stringifyValue(allocator, ast, idx)) |v| { + defer allocator.free(v); + try writer.writeAll(v); + } else { + return error.UnknownType; + } +} + +pub fn main() !void { + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + defer _ = gpa.deinit(); + const allocator = gpa.allocator(); + + const path: ?[]const u8 = blk: { + const args = try std.process.argsAlloc(allocator); + defer std.process.argsFree(allocator, args); + if (args.len > 1) break :blk try allocator.dupe(u8, args[1]); + break :blk null; + }; + defer if (path) |p| allocator.free(p); + + const zon = blk: { + var file = try std.fs.cwd().openFile(path orelse "build.zig.zon", .{.mode = .read_only}); + defer file.close(); + const buf = try allocator.allocSentinel(u8, try file.getEndPos(), 0); + _ = try file.reader().readAll(buf); + break :blk buf; + }; + defer allocator.free(zon); + + var ast = try std.zig.Ast.parse(allocator, zon, .zon); + defer ast.deinit(allocator); + + if (ast.errors.len > 0) { + var writer = std.io.getStdErr().writer(); + for (ast.errors) |e| { + const loc = ast.tokenLocation(ast.errorOffset(e), e.token); + try writer.print("error: {s}:{}:{}: ", .{path orelse "build.zig.zon", loc.line, loc.column}); + try ast.renderError(e, writer); + try writer.writeAll("\n"); + } + return error.ParseFailed; + } + + var json = std.ArrayList(u8).init(allocator); + defer json.deinit(); + try stringify(allocator, json.writer(), ast, ast.nodes.items(.data)[0].lhs, false); + try std.io.getStdOut().writer().writeAll(json.items); +} diff --git a/versions.json b/versions.json new file mode 100644 index 0000000..79a27ba --- /dev/null +++ b/versions.json @@ -0,0 +1,637 @@ +{ + "master": { + "version": "0.12.0-dev.2139+e025ad7b4", + "date": "2024-01-10", + "docs": "https://ziglang.org/documentation/master/", + "stdDocs": "https://ziglang.org/documentation/master/std/", + "src": { + "tarball": "https://ziglang.org/builds/zig-0.12.0-dev.2139+e025ad7b4.tar.xz", + "shasum": "3203fec170720df01177accc79529020a73c93008234b965a046a3bfcf881568", + "size": "16975544" + }, + "bootstrap": { + "tarball": "https://ziglang.org/builds/zig-bootstrap-0.12.0-dev.2139+e025ad7b4.tar.xz", + "shasum": "3a85dd5f313f0da1306aea83275baedb106ef64c9c77ed98664be9f27756a8d1", + "size": "45420020" + }, + "x86_64-macos": { + "tarball": "https://ziglang.org/builds/zig-macos-x86_64-0.12.0-dev.2139+e025ad7b4.tar.xz", + "shasum": "8070e8b095e4d50b542cfb9add78352d1065111727673df6ec3cd5094a023ea9", + "size": "50360128" + }, + "aarch64-macos": { + "tarball": "https://ziglang.org/builds/zig-macos-aarch64-0.12.0-dev.2139+e025ad7b4.tar.xz", + "shasum": "63f851a52b7187b26800fafd8dfb27d461f1a0e6b936411c427d7b79df4a85b6", + "size": "46816064" + }, + "x86_64-linux": { + "tarball": "https://ziglang.org/builds/zig-linux-x86_64-0.12.0-dev.2139+e025ad7b4.tar.xz", + "shasum": "73ab9fa21f8f4d6c87443b4248b653f55abdab1db8331d392a75414e7c9235fd", + "size": "48066908" + }, + "aarch64-linux": { + "tarball": "https://ziglang.org/builds/zig-linux-aarch64-0.12.0-dev.2139+e025ad7b4.tar.xz", + "shasum": "e1cab0124b479e14950f3a6033637413bbc041039a67a01c239ad1ef7f5e47b6", + "size": "44437556" + }, + "armv7a-linux": { + "tarball": "https://ziglang.org/builds/zig-linux-armv7a-0.12.0-dev.2139+e025ad7b4.tar.xz", + "shasum": "2517ae600cdc6edf548f4c2192e9841a6f04c1dbaa0a396b94636452c87f308c", + "size": "45199604" + }, + "riscv64-linux": { + "tarball": "https://ziglang.org/builds/zig-linux-riscv64-0.12.0-dev.2139+e025ad7b4.tar.xz", + "shasum": "d918dbec3970ae80a463c9033646186ab9269f45b995b839639052c35d831e6e", + "size": "46508084" + }, + "powerpc64le-linux": { + "tarball": "https://ziglang.org/builds/zig-linux-powerpc64le-0.12.0-dev.2139+e025ad7b4.tar.xz", + "shasum": "a9f3da4add886b3d5590e7e55c4a34f3e0ea138febd6ae9357bd040479d4e205", + "size": "47817180" + }, + "powerpc-linux": { + "tarball": "https://ziglang.org/builds/zig-linux-powerpc-0.12.0-dev.2139+e025ad7b4.tar.xz", + "shasum": "45414c13a5af36f931b0a23a4a71ced433340b3bc6ed1f507b2a888b65d159ec", + "size": "47566436" + }, + "x86-linux": { + "tarball": "https://ziglang.org/builds/zig-linux-x86-0.12.0-dev.2139+e025ad7b4.tar.xz", + "shasum": "a8f37ee235860e64938ceb07248a9844403a73bdec6741bda1ac1d6286930559", + "size": "53098816" + }, + "x86_64-windows": { + "tarball": "https://ziglang.org/builds/zig-windows-x86_64-0.12.0-dev.2139+e025ad7b4.zip", + "shasum": "b205d0ea9e392e1962a2e23a46816723b407dff28129cfb9fd86e119294a749d", + "size": "82004734" + }, + "aarch64-windows": { + "tarball": "https://ziglang.org/builds/zig-windows-aarch64-0.12.0-dev.2139+e025ad7b4.zip", + "shasum": "0000088886bc2c50befc8d66a5352d721b198c159370e093be0d731efa91357b", + "size": "78565467" + }, + "x86-windows": { + "tarball": "https://ziglang.org/builds/zig-windows-x86-0.12.0-dev.2139+e025ad7b4.zip", + "shasum": "cb3998eab945a0fa713004b897e609be0b3f30ce62617884a54f8e908f6e6f0e", + "size": "86503979" + } + }, + "0.11.0": { + "date": "2023-08-04", + "docs": "https://ziglang.org/documentation/0.11.0/", + "stdDocs": "https://ziglang.org/documentation/0.11.0/std/", + "notes": "https://ziglang.org/download/0.11.0/release-notes.html", + "src": { + "tarball": "https://ziglang.org/download/0.11.0/zig-0.11.0.tar.xz", + "shasum": "72014e700e50c0d3528cef3adf80b76b26ab27730133e8202716a187a799e951", + "size": "15275316" + }, + "bootstrap": { + "tarball": "https://ziglang.org/download/0.11.0/zig-bootstrap-0.11.0.tar.xz", + "shasum": "38dd9e17433c7ce5687c48fa0a757462cbfcbe75d9d5087d14ebbe00efd21fdc", + "size": "43227592" + }, + "x86_64-freebsd": { + "tarball": "https://ziglang.org/download/0.11.0/zig-freebsd-x86_64-0.11.0.tar.xz", + "shasum": "ea430327f9178377b79264a1d492868dcff056cd76d43a6fb00719203749e958", + "size": "46432140" + }, + "x86_64-macos": { + "tarball": "https://ziglang.org/download/0.11.0/zig-macos-x86_64-0.11.0.tar.xz", + "shasum": "1c1c6b9a906b42baae73656e24e108fd8444bb50b6e8fd03e9e7a3f8b5f05686", + "size": "47189164" + }, + "aarch64-macos": { + "tarball": "https://ziglang.org/download/0.11.0/zig-macos-aarch64-0.11.0.tar.xz", + "shasum": "c6ebf927bb13a707d74267474a9f553274e64906fd21bf1c75a20bde8cadf7b2", + "size": "43855096" + }, + "x86_64-linux": { + "tarball": "https://ziglang.org/download/0.11.0/zig-linux-x86_64-0.11.0.tar.xz", + "shasum": "2d00e789fec4f71790a6e7bf83ff91d564943c5ee843c5fd966efc474b423047", + "size": "44961892" + }, + "aarch64-linux": { + "tarball": "https://ziglang.org/download/0.11.0/zig-linux-aarch64-0.11.0.tar.xz", + "shasum": "956eb095d8ba44ac6ebd27f7c9956e47d92937c103bf754745d0a39cdaa5d4c6", + "size": "41492432" + }, + "armv7a-linux": { + "tarball": "https://ziglang.org/download/0.11.0/zig-linux-armv7a-0.11.0.tar.xz", + "shasum": "aebe8bbeca39f13f9b7304465f9aee01ab005d243836bd40f4ec808093dccc9b", + "size": "42240664" + }, + "riscv64-linux": { + "tarball": "https://ziglang.org/download/0.11.0/zig-linux-riscv64-0.11.0.tar.xz", + "shasum": "24a478937eddb507e96d60bd4da00de9092b3f0920190eb45c4c99c946b00ed5", + "size": "43532324" + }, + "powerpc64le-linux": { + "tarball": "https://ziglang.org/download/0.11.0/zig-linux-powerpc64le-0.11.0.tar.xz", + "shasum": "75260e87325e820a278cf9e74f130c7b3d84c0b5197afb2e3c85eff3fcedd48d", + "size": "44656184" + }, + "powerpc-linux": { + "tarball": "https://ziglang.org/download/0.11.0/zig-linux-powerpc-0.11.0.tar.xz", + "shasum": "70a5f9668a66fb2a91a7c3488b15bcb568e1f9f44b95cd10075c138ad8c42864", + "size": "44539972" + }, + "x86-linux": { + "tarball": "https://ziglang.org/download/0.11.0/zig-linux-x86-0.11.0.tar.xz", + "shasum": "7b0dc3e0e070ae0e0d2240b1892af6a1f9faac3516cae24e57f7a0e7b04662a8", + "size": "49824456" + }, + "x86_64-windows": { + "tarball": "https://ziglang.org/download/0.11.0/zig-windows-x86_64-0.11.0.zip", + "shasum": "142caa3b804d86b4752556c9b6b039b7517a08afa3af842645c7e2dcd125f652", + "size": "77216743" + }, + "aarch64-windows": { + "tarball": "https://ziglang.org/download/0.11.0/zig-windows-aarch64-0.11.0.zip", + "shasum": "5d4bd13db5ecb0ddc749231e00f125c1d31087d708e9ff9b45c4f4e13e48c661", + "size": "73883137" + }, + "x86-windows": { + "tarball": "https://ziglang.org/download/0.11.0/zig-windows-x86-0.11.0.zip", + "shasum": "e72b362897f28c671633e650aa05289f2e62b154efcca977094456c8dac3aefa", + "size": "81576961" + } + }, + "0.10.1": { + "date": "2023-01-19", + "docs": "https://ziglang.org/documentation/0.10.1/", + "stdDocs": "https://ziglang.org/documentation/0.10.1/std/", + "notes": "https://ziglang.org/download/0.10.1/release-notes.html", + "src": { + "tarball": "https://ziglang.org/download/0.10.1/zig-0.10.1.tar.xz", + "shasum": "69459bc804333df077d441ef052ffa143d53012b655a51f04cfef1414c04168c", + "size": "15143112" + }, + "bootstrap": { + "tarball": "https://ziglang.org/download/0.10.1/zig-bootstrap-0.10.1.tar.xz", + "shasum": "9f5781210b9be8f832553d160851635780f9bd71816065351ab29cfd8968f5e9", + "size": "43971816" + }, + "x86_64-macos": { + "tarball": "https://ziglang.org/download/0.10.1/zig-macos-x86_64-0.10.1.tar.xz", + "shasum": "02483550b89d2a3070c2ed003357fd6e6a3059707b8ee3fbc0c67f83ca898437", + "size": "45119596" + }, + "aarch64-macos": { + "tarball": "https://ziglang.org/download/0.10.1/zig-macos-aarch64-0.10.1.tar.xz", + "shasum": "b9b00477ec5fa1f1b89f35a7d2a58688e019910ab80a65eac2a7417162737656", + "size": "40517896" + }, + "x86_64-linux": { + "tarball": "https://ziglang.org/download/0.10.1/zig-linux-x86_64-0.10.1.tar.xz", + "shasum": "6699f0e7293081b42428f32c9d9c983854094bd15fee5489f12c4cf4518cc380", + "size": "44085596" + }, + "aarch64-linux": { + "tarball": "https://ziglang.org/download/0.10.1/zig-linux-aarch64-0.10.1.tar.xz", + "shasum": "db0761664f5f22aa5bbd7442a1617dd696c076d5717ddefcc9d8b95278f71f5d", + "size": "40321280" + }, + "riscv64-linux": { + "tarball": "https://ziglang.org/download/0.10.1/zig-linux-riscv64-0.10.1.tar.xz", + "shasum": "9db5b59a5112b8beb995094ba800e88b0060e9cf7cfadf4dc3e666c9010dc77b", + "size": "42196008" + }, + "i386-linux": { + "tarball": "https://ziglang.org/download/0.10.1/zig-linux-i386-0.10.1.tar.xz", + "shasum": "8c710ca5966b127b0ee3efba7310601ee57aab3dd6052a082ebc446c5efb2316", + "size": "48367388" + }, + "x86_64-windows": { + "tarball": "https://ziglang.org/download/0.10.1/zig-windows-x86_64-0.10.1.zip", + "shasum": "5768004e5e274c7969c3892e891596e51c5df2b422d798865471e05049988125", + "size": "73259729" + }, + "aarch64-windows": { + "tarball": "https://ziglang.org/download/0.10.1/zig-windows-aarch64-0.10.1.zip", + "shasum": "ece93b0d77b2ab03c40db99ef7ccbc63e0b6bd658af12b97898960f621305428", + "size": "69417459" + } + }, + "0.10.0": { + "date": "2022-10-31", + "docs": "https://ziglang.org/documentation/0.10.0/", + "stdDocs": "https://ziglang.org/documentation/0.10.0/std/", + "notes": "https://ziglang.org/download/0.10.0/release-notes.html", + "src": { + "tarball": "https://ziglang.org/download/0.10.0/zig-0.10.0.tar.xz", + "shasum": "d8409f7aafc624770dcd050c8fa7e62578be8e6a10956bca3c86e8531c64c136", + "size": "14530912" + }, + "bootstrap": { + "tarball": "https://ziglang.org/download/0.10.0/zig-bootstrap-0.10.0.tar.xz", + "shasum": "c13dc70c4ff4c09f749adc0d473cbd3942991dd4d1bd2d860fbf257d8c1bbabf", + "size": "45625516" + }, + "x86_64-freebsd": { + "tarball": "https://ziglang.org/download/0.10.0/zig-freebsd-x86_64-0.10.0.tar.xz", + "shasum": "dd77afa2a8676afbf39f7d6068eda81b0723afd728642adaac43cb2106253d65", + "size": "44056504" + }, + "aarch64-linux": { + "tarball": "https://ziglang.org/download/0.10.0/zig-linux-aarch64-0.10.0.tar.xz", + "shasum": "09ef50c8be73380799804169197820ee78760723b0430fa823f56ed42b06ea0f", + "size": "40387688" + }, + "armv7a-linux": { + "tarball": "https://ziglang.org/download/0.10.0/zig-linux-armv7a-0.10.0.tar.xz", + "shasum": "7201b2e89cd7cc2dde95d39485fd7d5641ba67dc6a9a58c036cb4c308d2e82de", + "size": "50805936" + }, + "i386-linux": { + "tarball": "https://ziglang.org/download/0.10.0/zig-linux-i386-0.10.0.tar.xz", + "shasum": "dac8134f1328c50269f3e50b334298ec7916cb3b0ef76927703ddd1c96fd0115", + "size": "48451732" + }, + "riscv64-linux": { + "tarball": "https://ziglang.org/download/0.10.0/zig-linux-riscv64-0.10.0.tar.xz", + "shasum": "2a126f3401a7a7efc4b454f0a85c133db1af5a9dfee117f172213b7cbd47bfba", + "size": "42272968" + }, + "x86_64-linux": { + "tarball": "https://ziglang.org/download/0.10.0/zig-linux-x86_64-0.10.0.tar.xz", + "shasum": "631ec7bcb649cd6795abe40df044d2473b59b44e10be689c15632a0458ddea55", + "size": "44142400" + }, + "aarch64-macos": { + "tarball": "https://ziglang.org/download/0.10.0/zig-macos-aarch64-0.10.0.tar.xz", + "shasum": "02f7a7839b6a1e127eeae22ea72c87603fb7298c58bc35822a951479d53c7557", + "size": "40602664" + }, + "x86_64-macos": { + "tarball": "https://ziglang.org/download/0.10.0/zig-macos-x86_64-0.10.0.tar.xz", + "shasum": "3a22cb6c4749884156a94ea9b60f3a28cf4e098a69f08c18fbca81c733ebfeda", + "size": "45175104" + }, + "x86_64-windows": { + "tarball": "https://ziglang.org/download/0.10.0/zig-windows-x86_64-0.10.0.zip", + "shasum": "a66e2ff555c6e48781de1bcb0662ef28ee4b88af3af2a577f7b1950e430897ee", + "size": "73181558" + }, + "aarch64-windows": { + "tarball": "https://ziglang.org/download/0.10.0/zig-windows-aarch64-0.10.0.zip", + "shasum": "1bbda8d123d44f3ae4fa90d0da04b1e9093c3f9ddae3429a4abece1e1c0bf19a", + "size": "69332389" + } + }, + "0.9.1": { + "date": "2022-02-14", + "docs": "https://ziglang.org/documentation/0.9.1/", + "stdDocs": "https://ziglang.org/documentation/0.9.1/std/", + "notes": "https://ziglang.org/download/0.9.1/release-notes.html", + "src": { + "tarball": "https://ziglang.org/download/0.9.1/zig-0.9.1.tar.xz", + "shasum": "38cf4e84481f5facc766ba72783e7462e08d6d29a5d47e3b75c8ee3142485210", + "size": "13940828" + }, + "bootstrap": { + "tarball": "https://ziglang.org/download/0.9.1/zig-bootstrap-0.9.1.tar.xz", + "shasum": "0a8e221c71860d8975c15662b3ed3bd863e81c4fe383455a596e5e0e490d6109", + "size": "42488812" + }, + "x86_64-freebsd": { + "tarball": "https://ziglang.org/download/0.9.1/zig-freebsd-x86_64-0.9.1.tar.xz", + "shasum": "4e06009bd3ede34b72757eec1b5b291b30aa0d5046dadd16ecb6b34a02411254", + "size": "39028848" + }, + "aarch64-linux": { + "tarball": "https://ziglang.org/download/0.9.1/zig-linux-aarch64-0.9.1.tar.xz", + "shasum": "5d99a39cded1870a3fa95d4de4ce68ac2610cca440336cfd252ffdddc2b90e66", + "size": "37034860" + }, + "armv7a-linux": { + "tarball": "https://ziglang.org/download/0.9.1/zig-linux-armv7a-0.9.1.tar.xz", + "shasum": "6de64456cb4757a555816611ea697f86fba7681d8da3e1863fa726a417de49be", + "size": "37974652" + }, + "i386-linux": { + "tarball": "https://ziglang.org/download/0.9.1/zig-linux-i386-0.9.1.tar.xz", + "shasum": "e776844fecd2e62fc40d94718891057a1dbca1816ff6013369e9a38c874374ca", + "size": "44969172" + }, + "riscv64-linux": { + "tarball": "https://ziglang.org/download/0.9.1/zig-linux-riscv64-0.9.1.tar.xz", + "shasum": "208dea53662c2c52777bd9e3076115d2126a4f71aed7f2ff3b8fe224dc3881aa", + "size": "39390868" + }, + "x86_64-linux": { + "tarball": "https://ziglang.org/download/0.9.1/zig-linux-x86_64-0.9.1.tar.xz", + "shasum": "be8da632c1d3273f766b69244d80669fe4f5e27798654681d77c992f17c237d7", + "size": "41011464" + }, + "aarch64-macos": { + "tarball": "https://ziglang.org/download/0.9.1/zig-macos-aarch64-0.9.1.tar.xz", + "shasum": "8c473082b4f0f819f1da05de2dbd0c1e891dff7d85d2c12b6ee876887d438287", + "size": "38995640" + }, + "x86_64-macos": { + "tarball": "https://ziglang.org/download/0.9.1/zig-macos-x86_64-0.9.1.tar.xz", + "shasum": "2d94984972d67292b55c1eb1c00de46580e9916575d083003546e9a01166754c", + "size": "43713044" + }, + "i386-windows": { + "tarball": "https://ziglang.org/download/0.9.1/zig-windows-i386-0.9.1.zip", + "shasum": "74a640ed459914b96bcc572183a8db687bed0af08c30d2ea2f8eba03ae930f69", + "size": "67929868" + }, + "x86_64-windows": { + "tarball": "https://ziglang.org/download/0.9.1/zig-windows-x86_64-0.9.1.zip", + "shasum": "443da53387d6ae8ba6bac4b3b90e9fef4ecbe545e1c5fa3a89485c36f5c0e3a2", + "size": "65047697" + }, + "aarch64-windows": { + "tarball": "https://ziglang.org/download/0.9.1/zig-windows-aarch64-0.9.1.zip", + "shasum": "621bf95f54dc3ff71466c5faae67479419951d7489e40e87fd26d195825fb842", + "size": "61478151" + } + }, + "0.9.0": { + "date": "2021-12-20", + "docs": "https://ziglang.org/documentation/0.9.0/", + "stdDocs": "https://ziglang.org/documentation/0.9.0/std/", + "notes": "https://ziglang.org/download/0.9.0/release-notes.html", + "src": { + "tarball": "https://ziglang.org/download/0.9.0/zig-0.9.0.tar.xz", + "shasum": "cd1be83b12f8269cc5965e59877b49fdd8fa638efb6995ac61eb4cea36a2e381", + "size": "13928772" + }, + "bootstrap": { + "tarball": "https://ziglang.org/download/0.9.0/zig-bootstrap-0.9.0.tar.xz", + "shasum": "16b0bdf0bc0a5ed1e0950e08481413d806192e06443a512347526647b2baeabc", + "size": "42557736" + }, + "x86_64-freebsd": { + "tarball": "https://ziglang.org/download/0.9.0/zig-freebsd-x86_64-0.9.0.tar.xz", + "shasum": "c95afe679b7cc4110dc2ecd3606c83a699718b7a958d6627f74c20886333e194", + "size": "41293236" + }, + "aarch64-linux": { + "tarball": "https://ziglang.org/download/0.9.0/zig-linux-aarch64-0.9.0.tar.xz", + "shasum": "1524fedfdbade2dbc9bae1ed98ad38fa7f2114c9a3e94da0d652573c75efbc5a", + "size": "40008396" + }, + "armv7a-linux": { + "tarball": "https://ziglang.org/download/0.9.0/zig-linux-armv7a-0.9.0.tar.xz", + "shasum": "50225dee6e6448a63ee96383a34d9fe3bba34ae8da1a0c8619bde2cdfc1df87d", + "size": "41196876" + }, + "i386-linux": { + "tarball": "https://ziglang.org/download/0.9.0/zig-linux-i386-0.9.0.tar.xz", + "shasum": "b0dcf688349268c883292acdd55eaa3c13d73b9146e4b990fad95b84a2ac528b", + "size": "47408656" + }, + "riscv64-linux": { + "tarball": "https://ziglang.org/download/0.9.0/zig-linux-riscv64-0.9.0.tar.xz", + "shasum": "85466de07504767ed37f59782672ad41bbdf43d6480fafd07f45543278b07620", + "size": "44171420" + }, + "x86_64-linux": { + "tarball": "https://ziglang.org/download/0.9.0/zig-linux-x86_64-0.9.0.tar.xz", + "shasum": "5c55344a877d557fb1b28939785474eb7f4f2f327aab55293998f501f7869fa6", + "size": "43420796" + }, + "aarch64-macos": { + "tarball": "https://ziglang.org/download/0.9.0/zig-macos-aarch64-0.9.0.tar.xz", + "shasum": "3991c70594d61d09fb4b316157a7c1d87b1d4ec159e7a5ecd11169ff74cad832", + "size": "39013392" + }, + "x86_64-macos": { + "tarball": "https://ziglang.org/download/0.9.0/zig-macos-x86_64-0.9.0.tar.xz", + "shasum": "c5280eeec4d6e5ea5ce5b448dc9a7c4bdd85ecfed4c1b96aa0835e48b36eccf0", + "size": "43764596" + }, + "i386-windows": { + "tarball": "https://ziglang.org/download/0.9.0/zig-windows-i386-0.9.0.zip", + "shasum": "bb839434afc75092015cf4c33319d31463c18512bc01dd719aedf5dcbc368466", + "size": "67946715" + }, + "x86_64-windows": { + "tarball": "https://ziglang.org/download/0.9.0/zig-windows-x86_64-0.9.0.zip", + "shasum": "084ea2646850aaf068234b0f1a92b914ed629be47075e835f8a67d55c21d880e", + "size": "65045849" + }, + "aarch64-windows": { + "tarball": "https://ziglang.org/download/0.9.0/zig-windows-aarch64-0.9.0.zip", + "shasum": "f9018725e3fb2e8992b17c67034726971156eb190685018a9ac8c3a9f7a22340", + "size": "61461921" + } + }, + "0.8.1": { + "date": "2021-09-06", + "docs": "https://ziglang.org/documentation/0.8.1/", + "stdDocs": "https://ziglang.org/documentation/0.8.1/std/", + "notes": "https://ziglang.org/download/0.8.1/release-notes.html", + "src": { + "tarball": "https://ziglang.org/download/0.8.1/zig-0.8.1.tar.xz", + "shasum": "8c428e14a0a89cb7a15a6768424a37442292858cdb695e2eb503fa3c7bf47f1a", + "size": "12650228" + }, + "bootstrap": { + "tarball": "https://ziglang.org/download/0.8.1/zig-bootstrap-0.8.1.tar.xz", + "shasum": "fa1239247f830ecd51c42537043f5220e4d1dfefdc54356fa419616a0efb3902", + "size": "43613464" + }, + "x86_64-freebsd": { + "tarball": "https://ziglang.org/download/0.8.1/zig-freebsd-x86_64-0.8.1.tar.xz", + "shasum": "fc4f6478bcf3a9fce1b8ef677a91694f476dd35be6d6c9c4f44a8b76eedbe176", + "size": "39150924" + }, + "aarch64-linux": { + "tarball": "https://ziglang.org/download/0.8.1/zig-linux-aarch64-0.8.1.tar.xz", + "shasum": "2166dc9f2d8df387e8b4122883bb979d739281e1ff3f3d5483fec3a23b957510", + "size": "37605932" + }, + "armv7a-linux": { + "tarball": "https://ziglang.org/download/0.8.1/zig-linux-armv7a-0.8.1.tar.xz", + "shasum": "5ba58141805e2519f38cf8e715933cbf059f4f3dade92c71838cce341045de05", + "size": "39185876" + }, + "i386-linux": { + "tarball": "https://ziglang.org/download/0.8.1/zig-linux-i386-0.8.1.tar.xz", + "shasum": "2f3e84f30492b5f1c5f97cecc0166f07a8a8d50c5f85dbb3a6ef2a4ee6f915e6", + "size": "44782932" + }, + "riscv64-linux": { + "tarball": "https://ziglang.org/download/0.8.1/zig-linux-riscv64-0.8.1.tar.xz", + "shasum": "4adfaf147b025917c03367462fe5018aaa9edbc6439ef9cd0da2b074ae960554", + "size": "41234480" + }, + "x86_64-linux": { + "tarball": "https://ziglang.org/download/0.8.1/zig-linux-x86_64-0.8.1.tar.xz", + "shasum": "6c032fc61b5d77a3f3cf781730fa549f8f059ffdb3b3f6ad1c2994d2b2d87983", + "size": "41250060" + }, + "aarch64-macos": { + "tarball": "https://ziglang.org/download/0.8.1/zig-macos-aarch64-0.8.1.tar.xz", + "shasum": "5351297e3b8408213514b29c0a938002c5cf9f97eee28c2f32920e1227fd8423", + "size": "35340712" + }, + "x86_64-macos": { + "tarball": "https://ziglang.org/download/0.8.1/zig-macos-x86_64-0.8.1.tar.xz", + "shasum": "16b0e1defe4c1807f2e128f72863124bffdd906cefb21043c34b673bf85cd57f", + "size": "39946200" + }, + "i386-windows": { + "tarball": "https://ziglang.org/download/0.8.1/zig-windows-i386-0.8.1.zip", + "shasum": "099605051eb0452a947c8eab8fbbc7e43833c8376d267e94e41131c289a1c535", + "size": "64152358" + }, + "x86_64-windows": { + "tarball": "https://ziglang.org/download/0.8.1/zig-windows-x86_64-0.8.1.zip", + "shasum": "43573db14cd238f7111d6bdf37492d363f11ecd1eba802567a172f277d003926", + "size": "61897838" + } + }, + "0.8.0": { + "date": "2021-06-04", + "docs": "https://ziglang.org/documentation/0.8.0/", + "stdDocs": "https://ziglang.org/documentation/0.8.0/std/", + "notes": "https://ziglang.org/download/0.8.0/release-notes.html", + "src": { + "tarball": "https://ziglang.org/download/0.8.0/zig-0.8.0.tar.xz", + "shasum": "03a828d00c06b2e3bb8b7ff706997fd76bf32503b08d759756155b6e8c981e77", + "size": "12614896" + }, + "bootstrap": { + "tarball": "https://ziglang.org/download/0.8.0/zig-bootstrap-0.8.0.tar.xz", + "shasum": "10600bc9c01f92e343f40d6ecc0ad05d67d27c3e382bce75524c0639cd8ca178", + "size": "43574248" + }, + "x86_64-freebsd": { + "tarball": "https://ziglang.org/download/0.8.0/zig-freebsd-x86_64-0.8.0.tar.xz", + "shasum": "0d3ccc436c8c0f50fd55462f72f8492d98723c7218ffc2a8a1831967d81b4bdc", + "size": "39125332" + }, + "aarch64-linux": { + "tarball": "https://ziglang.org/download/0.8.0/zig-linux-aarch64-0.8.0.tar.xz", + "shasum": "ee204ca2c2037952cf3f8b10c609373a08a291efa4af7b3c73be0f2b27720470", + "size": "37575428" + }, + "armv7a-linux": { + "tarball": "https://ziglang.org/download/0.8.0/zig-linux-armv7a-0.8.0.tar.xz", + "shasum": "d00b8bd97b79f45d6f5da956983bafeaa082e6c2ae8c6e1c6d4faa22fa29b320", + "size": "38884212" + }, + "i386-linux": { + "tarball": "https://ziglang.org/download/0.8.0/zig-linux-i386-0.8.0.tar.xz", + "shasum": "96e43ee6ed81c3c63401f456bd1c58ee6d42373a43cb324f5cf4974ca0998865", + "size": "42136032" + }, + "riscv64-linux": { + "tarball": "https://ziglang.org/download/0.8.0/zig-linux-riscv64-0.8.0.tar.xz", + "shasum": "75997527a78cdab64c40c43d9df39c01c4cdb557bb3992a869838371a204cfea", + "size": "40016268" + }, + "x86_64-linux": { + "tarball": "https://ziglang.org/download/0.8.0/zig-linux-x86_64-0.8.0.tar.xz", + "shasum": "502625d3da3ae595c5f44a809a87714320b7a40e6dff4a895b5fa7df3391d01e", + "size": "41211184" + }, + "aarch64-macos": { + "tarball": "https://ziglang.org/download/0.8.0/zig-macos-aarch64-0.8.0.tar.xz", + "shasum": "b32d13f66d0e1ff740b3326d66a469ee6baddbd7211fa111c066d3bd57683111", + "size": "35292180" + }, + "x86_64-macos": { + "tarball": "https://ziglang.org/download/0.8.0/zig-macos-x86_64-0.8.0.tar.xz", + "shasum": "279f9360b5cb23103f0395dc4d3d0d30626e699b1b4be55e98fd985b62bc6fbe", + "size": "39969312" + }, + "i386-windows": { + "tarball": "https://ziglang.org/download/0.8.0/zig-windows-i386-0.8.0.zip", + "shasum": "b6ec9aa6cd6f3872fcb30d43ff411802d82008a0c4142ee49e208a09b2c1c5fe", + "size": "61507213" + }, + "x86_64-windows": { + "tarball": "https://ziglang.org/download/0.8.0/zig-windows-x86_64-0.8.0.zip", + "shasum": "8580fbbf3afb72e9b495c7f8aeac752a03475ae0bbcf5d787f3775c7e1f4f807", + "size": "61766193" + } + }, + "default": { + "version": "0.11.0", + "date": "2023-08-04", + "docs": "https://ziglang.org/documentation/0.11.0/", + "stdDocs": "https://ziglang.org/documentation/0.11.0/std/", + "notes": "https://ziglang.org/download/0.11.0/release-notes.html", + "src": { + "tarball": "https://ziglang.org/download/0.11.0/zig-0.11.0.tar.xz", + "shasum": "72014e700e50c0d3528cef3adf80b76b26ab27730133e8202716a187a799e951", + "size": "15275316" + }, + "bootstrap": { + "tarball": "https://ziglang.org/download/0.11.0/zig-bootstrap-0.11.0.tar.xz", + "shasum": "38dd9e17433c7ce5687c48fa0a757462cbfcbe75d9d5087d14ebbe00efd21fdc", + "size": "43227592" + }, + "x86_64-freebsd": { + "tarball": "https://ziglang.org/download/0.11.0/zig-freebsd-x86_64-0.11.0.tar.xz", + "shasum": "ea430327f9178377b79264a1d492868dcff056cd76d43a6fb00719203749e958", + "size": "46432140" + }, + "x86_64-macos": { + "tarball": "https://ziglang.org/download/0.11.0/zig-macos-x86_64-0.11.0.tar.xz", + "shasum": "1c1c6b9a906b42baae73656e24e108fd8444bb50b6e8fd03e9e7a3f8b5f05686", + "size": "47189164" + }, + "aarch64-macos": { + "tarball": "https://ziglang.org/download/0.11.0/zig-macos-aarch64-0.11.0.tar.xz", + "shasum": "c6ebf927bb13a707d74267474a9f553274e64906fd21bf1c75a20bde8cadf7b2", + "size": "43855096" + }, + "x86_64-linux": { + "tarball": "https://ziglang.org/download/0.11.0/zig-linux-x86_64-0.11.0.tar.xz", + "shasum": "2d00e789fec4f71790a6e7bf83ff91d564943c5ee843c5fd966efc474b423047", + "size": "44961892" + }, + "aarch64-linux": { + "tarball": "https://ziglang.org/download/0.11.0/zig-linux-aarch64-0.11.0.tar.xz", + "shasum": "956eb095d8ba44ac6ebd27f7c9956e47d92937c103bf754745d0a39cdaa5d4c6", + "size": "41492432" + }, + "armv7a-linux": { + "tarball": "https://ziglang.org/download/0.11.0/zig-linux-armv7a-0.11.0.tar.xz", + "shasum": "aebe8bbeca39f13f9b7304465f9aee01ab005d243836bd40f4ec808093dccc9b", + "size": "42240664" + }, + "riscv64-linux": { + "tarball": "https://ziglang.org/download/0.11.0/zig-linux-riscv64-0.11.0.tar.xz", + "shasum": "24a478937eddb507e96d60bd4da00de9092b3f0920190eb45c4c99c946b00ed5", + "size": "43532324" + }, + "powerpc64le-linux": { + "tarball": "https://ziglang.org/download/0.11.0/zig-linux-powerpc64le-0.11.0.tar.xz", + "shasum": "75260e87325e820a278cf9e74f130c7b3d84c0b5197afb2e3c85eff3fcedd48d", + "size": "44656184" + }, + "powerpc-linux": { + "tarball": "https://ziglang.org/download/0.11.0/zig-linux-powerpc-0.11.0.tar.xz", + "shasum": "70a5f9668a66fb2a91a7c3488b15bcb568e1f9f44b95cd10075c138ad8c42864", + "size": "44539972" + }, + "x86-linux": { + "tarball": "https://ziglang.org/download/0.11.0/zig-linux-x86-0.11.0.tar.xz", + "shasum": "7b0dc3e0e070ae0e0d2240b1892af6a1f9faac3516cae24e57f7a0e7b04662a8", + "size": "49824456" + }, + "x86_64-windows": { + "tarball": "https://ziglang.org/download/0.11.0/zig-windows-x86_64-0.11.0.zip", + "shasum": "142caa3b804d86b4752556c9b6b039b7517a08afa3af842645c7e2dcd125f652", + "size": "77216743" + }, + "aarch64-windows": { + "tarball": "https://ziglang.org/download/0.11.0/zig-windows-aarch64-0.11.0.zip", + "shasum": "5d4bd13db5ecb0ddc749231e00f125c1d31087d708e9ff9b45c4f4e13e48c661", + "size": "73883137" + }, + "x86-windows": { + "tarball": "https://ziglang.org/download/0.11.0/zig-windows-x86-0.11.0.zip", + "shasum": "e72b362897f28c671633e650aa05289f2e62b154efcca977094456c8dac3aefa", + "size": "81576961" + } + } +} diff --git a/versions.nix b/versions.nix new file mode 100644 index 0000000..39ba32e --- /dev/null +++ b/versions.nix @@ -0,0 +1,54 @@ +{ pkgs ? import {}, lib ? pkgs.lib, stdenv ? pkgs.stdenvNoCC, system ? builtins.currentSystem, installDocs ? false }: + +with lib; +with builtins; + +let + zig-system = concatStringsSep "-" (map (x: if x == "darwin" then "macos" else x) (splitString "-" system)); +in filterAttrs (n: v: v != null) (mapAttrs (k: v: let + res = v."${zig-system}" or null; +in if res == null then null else stdenv.mkDerivation (finalAttrs: { + pname = "zig"; + version = if v ? version then v.version else k; + + src = pkgs.fetchurl { + url = res.tarball; + sha256 = res.shasum; + }; + + dontConfigure = true; + dontBuild = true; + dontFixup = true; + + installPhase = '' + mkdir -p $out/{bin,lib} + cp -r lib/* $out/lib + install -Dm755 zig $out/bin/zig + install -m644 LICENSE $out/LICENSE + '' + lib.optionalString (installDocs) '' + mkdir -p $out/doc + if [[ -d docs ]]; then + cp -r docs $out/doc + else + cp -r doc $out/doc + fi + ''; + + passthru = { + date = v.date; + notes = v.notes; + stdDocs = v.stdDocs; + docs = v.docs; + size = res.size; + src = v.src; + hook = pkgs.zig.hook.override {zig = finalAttrs.finalPackage;}; + }; + + meta = with lib; { + homepage = "https://ziglang.org/"; + description = "General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software"; + license = licenses.mit; + platforms = platforms.unix; + maintainers = []; # needed by the setup hook + }; +})) (fromJSON (readFile ./versions.json)))