exilesprx/zig-installer
No description provided.
This program installs Zig and the Zig Language Server (ZLS). You can choose to install both or just one of them.
Note: This program must be run as root. Use sudo
when executing the binary.
Platform Support: Linux is fully supported. macOS builds are currently a work in progress.
Before running the program, ensure you have the following dependencies installed:
wget
(for downloading Zig binary)git
(for downloading ZLS)jq
(for parsing version information)minisign
(for verifying Zig download)xz
(for extracting archives)go build
Or use the justfile if available:
just build
sudo ./zig-install-{platform} [command] [OPTIONS]
install
: Install Zig and/or ZLS (default if no command specified)version
: Show version information about the installerenv
: Generate a template .env file--zig-only
: Install only Zig--zls-only
: Install only ZLS (Zig Language Server)--verbose
: Show detailed output during installation--no-color
: Disable colored output--env <file>
: Specify a custom environment file (default: .env
)--settings
: Show current configuration settings--log-file <file>
: Specify log file (default: zig-install.log
)--enable-log
: Enable/disable logging to file (enabled by default)--version, -v <version>
: Specify Zig version to install (default: latest master)This program can be configured in two ways (in order of precedence):
.env
fileBefore running the program, it will check for required dependencies like wget
, git
, jq
, minisign
, and xz
. If any are missing, it will inform you so you can install them.
You can create a .env
file in the same directory as the executable in two ways:
env
command to create a template:./zig-install-linux-amd64 env
--generate-env
flag with the install command:sudo ./zig-install-linux-amd64 install --generate-env
You can view your current configuration settings at any time using the --settings
flag:
./zig-install-linux-amd64 install --settings
# Zig download and verification
ZIG_PUB_KEY=RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U
ZIG_DOWN_URL=https://ziglang.org/builds/
ZIG_INDEX_URL=https://ziglang.org/download/index.json
The values override the defaults.
Creating a .env
file is optional, but it allows for easy customization without modifying the source code. It allows you to update settings in the event of:
When building from source, you can also customize some defaults using linker flags:
go build -ldflags="-X 'github.com/exilesprx/zig-install/internal/config.Version=VERSION'"
The justfile in this project automatically reads from the .env
file and sets the defaults during build.
Install both Zig and ZLS (latest master):
sudo ./zig-install-linux-amd64 install
Install only Zig:
sudo ./zig-install-linux-amd64 install --zig-only
Install only ZLS (Zig Language Server): Note: You must have Zig installed in order to compile ZLS.
sudo ./zig-install-linux-amd64 install --zls-only
Install a specific version (both Zig and ZLS will be installed at this version):
sudo ./zig-install-linux-amd64 install --version 0.11.0
Install only Zig at a specific version:
sudo ./zig-install-linux-amd64 install --zig-only --version 0.11.0
Install only ZLS (will use current Zig version regardless of --version):
sudo ./zig-install-linux-amd64 install --zls-only --version 0.11.0 # Note: version will be ignored
Install with verbose output and custom log file:
sudo ./zig-install-linux-amd64 install --verbose --log-file custom.log
Display the current settings:
./zig-install-linux-amd64 install --settings
Generate a template .env file:
./zig-install-linux-amd64 env
Show version information:
./zig-install-linux-amd64 version
The installer manages Zig and ZLS versions in the following way:
--version
, both Zig and ZLS will be installed at the specified version to ensure compatibility--zig-only
with --version
, only Zig will be installed at the specified version--zls-only
with --version
, ZLS will be installed matching your current Zig version, ignoring the specified versionThis versioning strategy ensures that Zig and ZLS remain compatible with each other.
zig-install.log
, but can be configured or disabledThis project is licensed under the MIT License.