Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Provide a Nix flake for Spago in Nix #963

Closed
wants to merge 8 commits into from
Closed

Conversation

thomashoneyman
Copy link
Member

@thomashoneyman thomashoneyman commented May 29, 2023

As per a few discussions we've had lately in the #spago channel of the https://purescript.org/chat, this PR demonstrates building Spago in this repository via the spago-nix project. This avoids, for example, the many horrors of node2nix, napalm, npmlock2nix, buildNpmPackage, etc., and includes conveniences for the PureScript portion of building the Spago bundle.

This PR demonstrates building Spago itself with Nix and exporting itself from a Nix flake so that users downstream can e.g. run:

nix run github:purescript/spago

and have access to Spago (or use it in their Nix builds). At the moment this is for demonstration purposes only — I don't intend this to be merged until we can discuss the implications.

@@ -27,5 +27,6 @@ mkShell {
easy-ps.purescript-language-server
easy-ps.purs-tidy
nodejs
esbuild
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this to the shell instead of npm dependencies, since it's not really needed there.

Comment on lines +71 to +75
pkgs.writeShellScriptBin "spago-run" ''
echo "$@"
${pkgs.nodejs}/bin/node --eval 'require("${packages.default}/bundle.js").main()' "$@"
''
}/bin/spago-run";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work right now — perhaps you know how to pass through arguments, @f-f, or how to change the esbuild command?

@thomashoneyman
Copy link
Member Author

An alternate implementation can be seen here:
https://github.com/thomashoneyman/purescript-nix/blob/main/spago/mkSpago.nix

@f-f f-f deleted the trh/nix branch October 3, 2023 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant