Purs-nix - manage PureScript projects with Nix

purs-nix is a PureScript build tool written in Nix with the goal of being able to manage your PureScript projects with just Nix, as well as easily being able to incorporate PureScript into bigger Nix builds. It’s currently unstable but far enough along that it can be used.

It has it’s own package set with some niceties that the standard package set currently lacks:

  • package namespaces
  • single source of truth for package info: you can store your package info in it’s own repository and just tell purs-nix where to look.
  • Module names are not required to be unique: an easy-to-use fix for the issues this could create is planned.

Despite having it’s own package set, non-namespaced packages will still comply with the registry.

If you’ve never used Nix before and are interested in giving it a try, I have some instructions to help you set it up in the repo!

There’s currently no FAQ or How To section, I would love to get feedback on what people find confusing/would like to see examples of.

repo: https://github.com/ursi/purs-nix

12 Likes

First of all, great project. I might try this out later next week (wanted to switch my build process to Nix anyway).

One thing I’m not sure about is the custom package set. Is there a good reason for at least not, say, extending or adapting the official package sets?

I’d also suggest adding a (possibly really short) reasoning why one would use this instead of nodejs/spago/bower/… I’m not sure everybody knows Nix and why it’s great. Not that you have to explain Nix or anything, just in the context of this package…

2 Likes

Great stuff! I’m happy to see more nix tooling around Purescript!

Just yesterday I setup nix tooling for a Purescript project using Justin Woo’s easy-purescript-nix. It was painless, and might also be a good option for those who want to use nix with spago and the official package set ecosystem.

So I had my reasons for this but when writing them out I realized you’re right. I think the best approach would be to set up some code gen for the official package set as a base, and then override it where appropriate with the setup I have now. Not sure when I’ll get around to setting that up though, cuz manually adding a new package is pretty painless.

I think purs-nix is mostly for people that already use nix, or for people that want more freedom with publishing packages, and I think I already make a case to both of those crowds pretty well. Short of just trying to sell nix itself, I’m not sure what else I could say. If you don’t have any interest in nix and don’t have any problems with the official package set, I’m not sure you have any reason to switch - at least not with the current feature set (that could change in the future). That being said, I’m open to suggestions.

One advantage purs-nix currently has over spago2nix it that has incremental builds! Afaik with spago2nix you need to recompile the whole project every time you make a change.

4 Likes

Okay that’s nice! I second the request to support the official package set though.

I didn’t even know there was spago2nix. Maybe you can add a section to the readme mentioning it (and possibly easy-purescript-nix).

Other than that, I totally agree that your target audience is Nix people.

Codegen for the official package set has been added!

2 Likes

Nix stable is now supported! flakes are no longer a requirement

5 Likes