I wanted to mess around with AWS Lambda using Purescript. The combination of NixOS (my main OS), npm, bower, purescript and pulp seemed intimidating so I've documented my work here:
Given a normal Purescript project with a src/Main.purs file like:
We need to include
pulp as a dependency in our package.json. Then we can use a Makefile such as:
- run npm install
- run pulp build and produce an
- replace the normal invocation with our Lambda hook. This is a horrible hack but it works :/
Now we just need a default.nix to set this up:
We need to reference node, npm, and purescript so that this all works.
Which we can stick into Lambda:
Easy-ish when you know how!