defun-games / claylib

A Common Lisp 2D/3D game toolkit built on top of Raylib 4.5.
zlib License
69 stars 4 forks source link

Use Guix and direnv #70

Closed simendsjo closed 1 year ago

simendsjo commented 1 year ago
simendsjo commented 1 year ago

This might be a bit controversial...

If you have Guix and direnv installed, it's enough to navigate to the claylib folder, and you'll have raylib and raygui built and installed in a deterministic fashion. For other systems (didn't detect running in direnv), the prebuilt libraries will still be used.

If you've never used Guix or Nix, I understand this might be a bit strange, but for us Guix users, it's great as we don't have to patch the libraries -- I actually had to build them myself.

I set the PR as draft as we discuss and review it.

shelvick commented 1 year ago

I'm going to get back to you on this. We're pondering some changes to the build process. #1 priority is making sure the build is straightforward on standard Linux and on Windows (the latter we don't have yet). I'm a little iffy on committing changes that only apply to Guix but I don't really know the norms there.

simendsjo commented 1 year ago

It's quite normal for projects to have nix-shell support, but Guix is not as popular although it's nice to use Guile Scheme rather than the homegrown Nix language together with shell scripts.

If you're on Linux, you should install both Guix and Nix (the latter because it has more libraries packaged if you need that).

I can maintain this from the outside although it's not as ergonomic because I have to maintain a commit that I never push (.envrc) upstream. The setup is quite nice though! You don't have to include libraries for Linux as those will be built by the user, and the libraries will work for all distributions -- a key feature of Nix and Guix. And because of direnv you don't have to do anything manually at all. Visiting the directory is enough to get a reproducible build which is the same for all operating systems and works for all (all dependencies are included down to glibc), which means there will be no "works on my system".

For Windows it's probably best to include all dependencies in the project though.

simendsjo commented 1 year ago

I can probably solve this with much less interference. I can create a new repo and have claylib as a subrepo. The only change I need would be to skip using claylibs libraries, maybe through an environment variable CLAYLIB_USE_SYSTEM_RAYLIB_LIBRARIES or similar. I'll come back with another PR.