corazza / idris-box2d

Box2D API for Idris
MIT License
8 stars 1 forks source link

Include box2d in nixpkgs #1

Open locallycompact opened 4 years ago

locallycompact commented 4 years ago

Hi. :) I was trying to play around with building your game with nix to manage idris dependencies. So far I had to make a nix expression for box2d and wondered if you might want to put a version number on it and I'll include it in nixpkgs.

https://github.com/locallycompact/nixpkgs/commit/4937b814bd90694768f7b737da9c0421fc23c79d

The following expression lets me run the Makefile at least. I know you have a modified sdl so the shell would need an override but box2d seems to link OK.

nix-shell -I nixpkgs=https://github.com/locallycompact/nixpkgs/tarball/master -p 'idrisPackages.with-packages(with idrisPackages; [box2d sdl2 containers contrib])'

Thanks.

corazza commented 4 years ago

Hi I'm not really familiar with Nix, what exactly do I need to do? At the moment I'm not even sure which version of Box2D I was using, this was all a few months ago and the whole build process was made kinda ad-hoc-ish :/

Btw seems like I forgot to push the latest version of this repo, I did now. I think the game builds against this version (it was installed locally on my machine but not pushed)

locallycompact commented 4 years ago

Basically I wanted to reduce the friction in the game repo to the point where you can just go nix-shell followed by make, and the shell will have pulled all the libraries into the environment. It should be possible with an nix overlay for the sdl2 fork (if I can figure out how to use these again). If you check out my fork and grab nix you can see how it works.

https://github.com/locallycompact/game-idris

The shell.nix file relies on a nixpkgs repo with the derivations for contrib, box2d etc. You should be able to run.

nix-shell -I nixpkgs=https://github.com/locallycompact/nixpkgs/tarball/master --pure

followed by make. The --pure makes sure nothing leaks in from your host so you should see it fail at getTicks.

My question was just if this library was in a state where you wanted to like, version it, and then I could offer the package definition upstream.

FYI it looks like this is the version of box2d C library in nixpkgs. https://github.com/NixOS/nixpkgs/blob/84cf00f98031e93f389f1eb93c4a7374a33cc0a9/pkgs/development/libraries/box2d/default.nix

corazza commented 4 years ago

Hmm... the code here is obscenely bad, just look at that ad-hoc serialization I do to pass arrays of floats through FFI because I didn't have the time to learn how to do it properly lol. And pretty much everything else is terrible. However I don't really have the time to fix it, I have to keep at pace with uni work. So as far as I'm concerned at the moment, sure, it can be versioned.

I'm not exactly sure what you meant by that, so I just added a version=0.1.0 line to the ipkg and a git tag.