Jump to: navigation, search
Zig is a general-purpose programming language and toolchain for maintaining robust, optimal and reusable software. Check out their website at https://ziglang.org


To install Zig on openSUSE, the preferred method is to install from upstream binaries or compile it yourself. But if you want what openSUSE provides you can run

This procedure was tested on tumbleweed
user $ sudo zypper in zig && zig zen

This will install the most recent version of Zig on openSUSE.

Access Documentation

It's better to check the upstream documentation at https://ziglang.org/documentation/. But in the case you do not have any network connection, run the command

user $ zig std

This will create an http server running a wasm-compiled webpage of Zig.


New package manager

Zig now has a package manager in Zon format. However, it's still premature and the release of the package manager is confusing. The command to vendor those packages from the new command is

user $ zig fetch --global-cache-dir vendor $URL

where URL is the URL of the package listed in the build.zig.zon file which is located at the top-most level of a typical Zig project.

Workaround for confusing package manager

However, this is tasking and a lot of copy and pasting so the workaround is just using the zig build command.

Specifically, doing the following will let you have a vendored tarball for packaging:

zig build --global-cache-dir vendor
pushd vendor
rm -rfv z  # deletes built files. this is needed so that you only have the dependencies and not the entire build cache
tar --zstd -cvf vendor.tar.zst vendor

This will create a vendor.tar.zst tarball of which you can copy as sources for OpenBuildService. The package that has updated to follow this style of packaging is River.