Can Rescript be installed with Nixpkgs/NixOS? On nixpkgs, I could install bs-platform, but not the new rescript version.
I also tried installed it through yarn on NixOS, but I get build failures in the pre/post install because it seems to be looking for global bins that don’t exists on NixOS.
Hm, we don’t offer any official Nix package… the bs-platform package was created by community members. Don’t really know much about Nix, so it’s probably pretty hard to diagnose the issue.
When installing rescript on NixOS using yarn/npm, you will notice that the shipped binaries don’t work. This is to be expected on NixOS. In my case, this causes the compiler to be compiled in the post-install hook of rescript. This takes a long time, but works if you have all the required build dependencies.
We have “solved” this by wrapping yarn with a script that calls autopatchelf on the shipped binaries at the right stage. With npm you can use a hook for this.
If ninja is not found it tries to build from from source with python using /usr/bin/python which doesn’t exits on nixos (I believe this was the path, I don’t recall 100% now). But after adding ninja to my nix shell, rescript was able to install as expected through yarn!
I’m hitting some other issues now though because a few of of my deps (relude & bs-bastet) use bisect_ppx & my project uses decco. I was able to fix the bisect_ppx problem by manually removing the dependencies bsconfig.json (since bisect is really a dev dependency for the projects that use them). But there seems to be some problem finding the decco ppx, the error I get is:
Dependency on decco
rescript: [1/6] src/Decco_Codecs.ast
FAILED: src/Decco_Codecs.ast
sh: /../project/node_modules/decco/./ppx: No such file or directory
We've found a bug for you!
/../project/node_modules/decco/src/Decco_Codecs.re
Error while running external preprocessor
Command line: /../project/node_modules/decco/./ppx '/tmp/ppx318601Decco_Codecs.re' '/tmp/ppx53767cDecco_Codecs.re'
rescript: [2/6] src/Decco.ast
FAILED: src/Decco.ast
sh: /../project/node_modules/decco/./ppx: No such file or directory
We've found a bug for you!
/../project/node_modules/decco/src/Decco.re
Error while running external preprocessor
Command line: /../project/node_modules/decco/./ppx '/tmp/ppxad34d4Decco.re' '/tmp/ppx0d38aeDecco.re'
FAILED: cannot make progress due to previous errors.
Failure: /../project/node_modules/rescript/linux/ninja.exe
Location: /../project/node_modules/decco/lib/bs
interesting! could you provide any examples on how to implement that? actually I didn’t know that rescript publish the binaries… this will hel me on how to port to nexos directly