nix-overlays icon indicating copy to clipboard operation
nix-overlays copied to clipboard

Upstream cross-compilation support

Open alyssais opened this issue 2 years ago • 1 comments

It would be really great if Nixpkgs could cross-compile OCaml out of the box. What would need to happen to get the cross-compilation support from this overlay upstream? I would be willing to put work into this, but if you already have thought about what would need to happen it would be great to hear from you.

alyssais avatar Mar 16 '23 14:03 alyssais

I agree this would be desirable to upstream. I haven't made many strides towards that however. Here's the current state of cross compilation support in this repo:

  • changes live in the cross/ folder
  • the OCaml compiler needs a small patch + a custom build process which you can find here
  • then we need to make the OCaml package set (esp. findlib) aware of the 2 toolchains (buildPackages and the cross-compilation environment). This is all done in cross/ocaml.nix
    • IMO this is where most of the complexity lies: nixpkgs uses OCAMLPATH to tell findlib about OCaml packages, but we need to actually write down findlib.conf files for both the build and cross toolchains.

I hope the above information gives you something to start with. Feel free to reach out for more questions otherwise.

anmonteiro avatar Mar 19 '23 20:03 anmonteiro