-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tentative nix support #155
Conversation
b012d88
to
0605f85
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lIlIlIlIIIIlIIIllIIlIllIIllIII for this PR! I don't know much about Nix, so I left some questions in my review. What bothers me the most is that the files are introducing duplication for package version numbers, github revision hashes, etc. that dune + opam already solve from dune-project
. I would understand if there's no way to generate the .nix
files from dune-project
, but then we should be at least putting the nix build under CI with GitHub actions to ensure it's working all the time. This would also be a good occasion to make a doc todo-list about what to do when changing the OCaml dependencies of the project.
@@ -1,5 +1,6 @@ | |||
_build/ | |||
_opam/ | |||
result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is result the place where nix puts its things ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. result
is a link to the store, where the built project will be.
|
||
# We need the very last version "bleeding edge" since previous versions don't use dune. | ||
|
||
buildDunePackage rec { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to put a specific Nix file for some OCaml opam package and not others ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the dependencies are already within the nixpkgs depot as for instance zarith. However, neither Bindlib nor unionfind are present within nixpkgs, hence the additional files.
|
||
useDune2 = true; | ||
|
||
src = fetchFromGitHub { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not very confortable with the duplication of version numbers, etc. that this thing introduces. Right now the dune-project
files describes the OCaml dependencies completely, the .opam
file is derived from it. Can't you derive this .nix
file from dune-project
too ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is some tools to generate .nix files from opam files such as opam2nix. Last time i've try to use such tools, it didn't work that well. Moreother, those tools are build by community members, whom might not have all their time to maintain those tools.
There is a major difference between opam and nix package management: for dune/opam you give constraints on the versions numbers, while nix requires version numbers to be explicit. Building a tool that translates dune-project constraints to nix derivations = requires to solve thoses constraints.
Finally, bindlib and unionfind version numbers are not to be understood as "duplication of version numbers", but as appendium to nixpkgs. Fortunally, it occurs that the version supplied is fully compatible with the dependencies of Catala, but it could as well not be the case.
@@ -0,0 +1,43 @@ | |||
diff --git a/compiler/catala_web.ml b/compiler/catala_web.ml | |||
deleted file mode 100644 | |||
index 31d5289..0000000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find it weird to apply a patch to remove code in order to build; what was the problem with the Web part ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had some issues with dllANSITerminal_stubs.so
not being found. After some search, it seems it is a nix/dune/ocaml integration problem:
ocamlc compiler/catala_web.bc (exit 2)
(cd _build/default &&
/nix/store/7pyygjpswdnvjk54kx40s2ifqblz6npd-ocaml-4.12.0/bin/ocamlc.opt -w -40 -g -o compiler/catala_web.bc
/nix/store/7nli0w88my167xqcdyjwqr1a5v9b8qcs-ocaml4.12.0-cmdliner-1.0.4/lib/ocaml/4.12.0/site-lib/cmdliner/cmdliner.cma
/nix/store/7pyygjpswdnvjk54kx40s2ifqblz6npd-ocaml-4.12.0/lib/ocaml/unix.cma
/nix/store/fz68mi5gpgyjjbg1qfchy41hwfv6pqj1-ocaml4.12.0-ansiterminal-0.7/lib/ocaml/4.12.0/site-lib/ANSITerminal/ANSITerminal.cma
/nix/store/dy39jrrm68szbgdj7drvkrgf1nby53ky-ocaml4.12.0-re-1.9.0/lib/ocaml/4.12.0/site-lib/re/re.cma compiler/utils/utils.cma
/nix/store/wzjwpzs8ghhnmwks40zs5r366prwrk72-menhir-20190626/lib/ocaml/4.12.0/site-lib/menhirLib/menhirLib.cmo
/nix/store/1j7ar5svzp0l768avi80vnbfhji4n56x-ocaml4.12.0-gen-0.5/lib/ocaml/4.12.0/site-lib/gen/gen.cma
/nix/store/80scpr99vndnwrnzp16gp2nl8mhj70y4-ocaml4.12.0-sedlex-2.3/lib/ocaml/4.12.0/site-lib/sedlex/sedlex.cma
/nix/store/j10vw3rv96sj54sszvsl4l71g2r3k92q-ocaml4.12.0-bindlib-5.0.1a/lib/ocaml/4.12.0/site-lib/bindlib/bindlib.cma
/nix/store/shanw2cl8gx0lg5k2533bm5yg5w7pcfr-ocaml4.12.0-unionFind-20200320/lib/ocaml/4.12.0/site-lib/unionFind/unionFind.cma
/nix/store/7pyygjpswdnvjk54kx40s2ifqblz6npd-ocaml-4.12.0/lib/ocaml/bigarray.cma
/nix/store/afhg1bsvwdl2wxlz9pb5rk7xqxb3gs88-ocaml4.12.0-camomile-1.0.2/lib/ocaml/4.12.0/site-lib/camomile/default_config/camomileDefaultConfig.cma
/nix/store/afhg1bsvwdl2wxlz9pb5rk7xqxb3gs88-ocaml4.12.0-camomile-1.0.2/lib/ocaml/4.12.0/site-lib/camomile/library/camomileLibrary.cma
/nix/store/afhg1bsvwdl2wxlz9pb5rk7xqxb3gs88-ocaml4.12.0-camomile-1.0.2/lib/ocaml/4.12.0/site-lib/camomile/lib_default/camomileLibraryDefault.cma
/nix/store/afhg1bsvwdl2wxlz9pb5rk7xqxb3gs88-ocaml4.12.0-camomile-1.0.2/lib/ocaml/4.12.0/site-lib/camomile/dyn/camomileLibraryDyn.cma
/nix/store/afhg1bsvwdl2wxlz9pb5rk7xqxb3gs88-ocaml4.12.0-camomile-1.0.2/lib/ocaml/4.12.0/site-lib/camomile/camomile_yuge.cma
/nix/store/7pyygjpswdnvjk54kx40s2ifqblz6npd-ocaml-4.12.0/lib/ocaml/str.cma
/nix/store/7fgmcv51jnr9dybvzn0kzc1anz32p4zi-ocaml-calendar-2.5/lib/ocaml/4.12.0/site-lib/calendar/calendarLib.cma
/nix/store/m2p9vpkhjahar3rhv23yadackxb3rls9-ocaml4.12.0-zarith-1.12/lib/ocaml/4.12.0/site-lib/zarith/zarith.cma
/nix/store/c95cr5qnl8da72wplcrbb3ndy07fnvcv-ocaml4.12.0-zarith_stubs_js-0.14.0/lib/ocaml/4.12.0/site-lib/zarith_stubs_js/zarith_stubs_js.cma compiler/runtime.cma
/nix/store/akfb3mx8ifp3xgskmj254pzngd3xc062-ocaml4.12.0-result-1.5/lib/ocaml/4.12.0/site-lib/result/result.cma
/nix/store/cgzqlsv4m7kw4jm97cs8jhc3rm83vsbz-ocaml4.12.0-ppx_deriving-5.2.1/lib/ocaml/4.12.0/site-lib/ppx_deriving/runtime/ppx_deriving_runtime.cma
/nix/store/cmi201k1s07j99vk42vbgc72hfn64md3-ocaml4.12.0-visitors-20210316/lib/ocaml/4.12.0/site-lib/visitors/runtime/VisitorsRuntime.cma compiler/dcalc/dcalc.cma
/nix/store/s7z5s9cvh465hjjl1i5myn0sja3a3bz8-ocamlgraph-1.8.8/lib/ocaml/4.12.0/site-lib/ocamlgraph/graph.cma
compiler/scopelang/scopelang.cma
compiler/desugared/desugared.cma
compiler/surface/surface.cma
compiler/literate/literate.cma
compiler/lcalc/lcalc.cma
compiler/scalc/scalc.cma
compiler/driver.cma
/nix/store/yhiyadmaq1jwacfvl9p7n9bqnm8f2gf6-ocaml4.12.0-js_of_ocaml-3.9.1/lib/ocaml/4.12.0/site-lib/js_of_ocaml/js_of_ocaml.cma
compiler/.catala_web.eobjs/byte/dune__exe__Catala_web.cmo
)
Error: I/O error: dllANSITerminal_stubs.so: No such file or directory
Not really knowing what was going on nor how to fix it, I decided to just disable catala-web when building using nix.
I have the same issue when building make js_build
on my machine.
@@ -0,0 +1,23 @@ | |||
{ lib, fetchurl, buildDunePackage }: | |||
|
|||
buildDunePackage rec { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question than bindlib: why do you need this file + duplication of version numbers, etc.
sedlex_2 | ||
menhir | ||
cmdliner | ||
re |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same remark, I guess there's no tool that can generate that from dune-project
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should be able to make a small python script that parses dune-project and put the constraints as asserts in the default.nix file.
Thanks! Now that it's under CI, we'll make sure it gets maintained. But you should file an issue for this story of problem with |
Initial nix support + some documentation, maybe not in the right place.