Spago2Nix: generate Nix expressions from Spago

At ZuriHac, I put together a utility to generate Nix expressions from Spago. It requires Spago, which is available now either via npm or from easy-purescript-nix

How do I use this?


First, generate the spago-packages.nix:

$ spago2nix generate
getting packages..
got 65 packages from Spago list-packages.
# ...
wrote spago-packages.nix

Then install these, optionally with more jobs provided to Nix:

$ spago2nix install -j 100
installing dependencies...
# ...
Wrote install script to .spago2nix/install

Then build the project:

# SOON: spago --no-install
$ spago2nix build
building project...
Wrote build script to .spago2nix/build

How does this work?

  1. I call Spago list-packages
  2. I generate Nix derivations for each package
  3. I give you ways to generate bash scripts that will ensure these inputs are available:

This means that once you have these, you really don’t need much more than to run nix-build spago-packages.nix -A installSpagoStyle to install these packages in your Nix store and get the bash script to copy these packages from your store to your project.

Of course, since I make this expression readily available to you, you can also choose to manipulate these in ways you see fit.


<insert generic Nix explanation>

I also needed this to replace my usage of Psc-Package2Nix with spago psc-package-insdhall on some of my projects.

Further questions

You should ask any specific questions in issues on the repo.


Here’s a post about this project: