tweag / opam-nix

Turn opam-based OCaml projects into Nix derivations
MIT License
111 stars 33 forks source link

example file #14

Closed mimoo closed 2 years ago

mimoo commented 2 years ago

I've been reading the excellent example here: https://github.com/brendanzab/ocaml-flake-example (from this thread: https://discourse.nixos.org/t/ocaml-example-project-using-flakes/16892)

It would be nice to have something similar for opam-nix, I admit that I'm a bit lost with the README :)

mimoo commented 2 years ago

for example, I'm getting the following error when trying to use buildOpamProject:

error: attribute 'buildOpamProject' missing

       at /nix/store/r5xh1fpj8f12rh4xf1hp87cb2ivsxr1b-source/flake.nix:50:24:

           49|           # Executed by `nix build .#byexample`
           50|           byexample = (opam-nix.buildOpamProject { } "byexample" ./tools { }).byexample;
             |                        ^
balsoft commented 2 years ago

You probably want opam-nix.lib.${system}.buildOpamProject . You can look at examples to find your way around: https://github.com/tweag/opam-nix/tree/main/examples . A very simple usage of buildOpamProject can be found here: https://github.com/tweag/opam-nix/blob/main/examples/opam2json/flake.nix

balsoft commented 2 years ago

Hopefully should be resolved with new, better templates from f4b388ddae8db9ac2ac452eb77bd5870ef6b3d7f