This repository is a Nix flake for building Zig projects with Raylib. It is currently based on the master
branch of Zig with the Zig-overlay. It use the raylib
package from the Nixpkgs repository.
This repository is meant to be used as a template for Zig projects that use Raylib. It provides a flake.nix
file that create a development environment with Zig and Raylib. It also provides a build.zig
file that can be used to build the project.
Note
It's a direct raylib binding from C to Zig. It's not a wrapper around the C library.
- 🌸 Nix
Important
You will need to enable nix-command
and flakes
experimental features
If you get an error about it, consider this command:
mkdir -p ~/.config/nix && echo "experimental-features = nix-command flakes" | tee ~/.config/nix/nix.conf
Clone this repository and run nix develop
to enter the development environment
git clone https://github.com/Miou-zora/Raylib-Zig-Nix.git
cd Raylib-Zig-Nix
nix develop
Warning
Don't forget to remove the .git
folder if you want to use this repository for a project.
Rename every name_of_your_project
in the project by the name of your project.
zig build
# It will build the project and run it. (do nothing if the project is already built)
zig build run
# or you can run the executable directly
./zig-out/bin/[name_of_your_project]
Note
nix build
is not supported yet. If you try to use it, it will create a result
symlink that contain the executable BUT musl isn't linked correctly to binary. It would be appreciated if someone could help me to fix this issue.
You may load the devShell automatically using direnv shell integration.
echo "use flake" | tee .envrc
direnv allow