Miou-zora/Raylib-Zig-Nix
Minimal project for Raylib + Zig (0.13.0) + Nix
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.
IMPORTANT You will need to enable
nix-commandandflakesexperimental 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
.gitfolder if you want to use this repository for a project.Rename every
name_of_your_projectin 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 buildis not supported yet. If you try to use it, it will create aresultsymlink 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