| tests | Make test_list faster to run by avoiding full tar unpacking ( #4 ) | |
| .containerignore | Initial commit | |
| .gitignore | Initial commit | |
| Containerfile | Initial commit | |
| iguana | Add verification of the minisign trusted comment ( #3 ) | |
| LICENSE | Initial commit | |
| Makefile | Add verification of the minisign trusted comment ( #3 ) | |
| README.md | Simplify script size linter ( #1 ) | |
iguana
Zig downloader and version manager in 64 lines of code
- Download and install the requested Zig version from a mirror, verifying the signature.
- Quickly switch between various Zig versions on the fly.
- Auditable, the whole self-contained script consists only of 64 lines of POSIX shell script, partitioned into separate functions.
Requirements
This software should work on a sufficiently modern POSIX system (including GNU/Linux and macOS) with the following software:
minisignsignature verifier, as described on Zig's download website.curlorwgetfor downloading software over HTTP.
Additionally, GNU Tar or a clone with --strip-components extension is required.
It's already present on GNU/Linux, busybox (including Alpine Linux),
macOS, and FreeBSD out of the box.
Setup
- Install iguana to a directory present in your
$PATHvariable.
$ cd ~/bin
$ curl -LO https://codeberg.org/mslapek/iguana/raw/iguana
- Manually change the platform at the top of the
iguanafile to the one used by your computer.
$ vi +10 iguana
Choose one of:
PLATFORM=aarch64-macos
PLATFORM=aarch64-linux
PLATFORM=x86_64-linux
Full list is available at Zig's download website.
- Audit it! The script has only 64 lines of code. Hopefully, you'll learn a trick or two in shell scripting.
$ wc -l iguana
64 iguana
- Make the script executable.
$ chmod a+x iguana
Now you're ready to go!
Basic usage
Run the following commands from your shell.
Install Zig
$ iguana install 0.16.0
$ iguana install 0.15.2
List installed versions
$ iguana list
Run Zig
$ iguana run 0.16.0 version
$ iguana run 0.16.0 zen
Zig shim
Instead of using iguana run, we can masquerade it as a zig.
First, add the shim.
$ ln -s iguana zig
Now you can just call Zig in your shell. By default, it'll use the latest installed version.
$ zig version # will print 0.16.0
To use older versions, just change the $ZIG_RELEASE environment variable.
$ export ZIG_RELEASE=0.15.2
$ zig version # will print 0.15.2
AI policy
No AI/LLMs were used in this project.
The script is the result of craftsmanship.
Other
Please leave a star on this project.
iguana is an independent implementation of Zig's version manager, NOT affiliated with the Zig Software Foundation.