Nix determinism with NPM packages

I have an app that I’m working on that uses Purescript.

I had abandoned purs-nix because it didn’t work with the newest spago and I was cruising albeit with an old-school non-deterministic build system.

Recently, I’ve been refactoring my dev environment to build nix-style using mkSpagoDerivation.

Anyway, I ran into a roadblock when it came time to bundle/build an npx package (vite) in that same lovely deterministic style in order to run a dev server.

I haven’t found anything that accomplishes this in the npm world via googling.

So, I currently build the fully deterministic parts that use Haskell (for my back end), a PostgreSQL NixOS service, and Purescript (the front end) using mkSpagoDerivation. But then when I go to launch/run the bundled app I have to build vite using the (gross :face_vomiting:) highly-deterministic npm style.
Since I see people packaging node modules for nixpkgs, I figure there has to be some method that I’m not finding in search. Npm2nix?

Am I doomed to non-determinism when I use NPM or is there some module that I’m missing?

Thank in advance for any advice you may give.strong text

Tonight, I’ll give node2nix a shot and share my results here.

After that, I’ll try GitHub - nix-community/npmlock2nix: nixify npm based packages [maintainer=@andir]

Here’s another recent solution:

1 Like