How to friend Spago with NixOS? (deeper than Spago2Nix)


That might be no news for you, but NixOS build environment cuts network fetching besides of own fetchGit and etc. queries. However, it messes much with Node and Spago particularly.

I’ve made an Nginx-hosted Purescript-based SPA for some project of ours. Everything worked well till we decided to start integrating it in a NixOS configuration. But it failed, as Spago (and NPM, too, but that’s not the story) tries fetching one’s package sets. --no-build flag bypasses that, --no-install doesn’t.

The problem is, we use bundle-module to create one-file JS to pack it with Parcel.
I’m not sure whether Spago2Nix would generate enough cache to simply sending bundle-module --no-build.

And again, even with --no-install it still fetches. Drawing a package set into a local file? Using Spago2Nix? (if you just assure me about the latter, I’ll just be glad)

UPD: BTW, assuring about spago -v and copying some used commands would be nice, too. I’ll be performing some research on my own and share my insights about that.
The final goal is NixOS-compatible Purescript bundle build with NPM dependencies added.


@ckopo IIRC Spago will try to download only two things:

  1. the package set file declared in the upstream of your packages.dhall
  2. the packages if they are not found in your local .spago directory

I think spago2nix fixes the second point, and you can fix the first point by dowloading the upstream locally (with fetchGit, or just versioning the file in the project), and pointing the upstream accordingly