Skip to content
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

Nix flake #30

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Nix flake #30

wants to merge 6 commits into from

Conversation

olynch
Copy link
Contributor

@olynch olynch commented Nov 26, 2024

This adds a flake file (simplified from #25), which supports a development environment as well as a static binary. Merge this after #29.

@olynch olynch mentioned this pull request Nov 26, 2024
@mikeshulman
Copy link
Owner

What version of OCaml will the nix build use? I can't find an indication of that in the files except for the dune saying that it requires ">= 5.2.0".

Actually, I don't see any indication in the files of what version of any of the opam dependencies (asai, fmlib, ...) will be used. It makes sense for it to be whatever version is currently available in opam for the chosen ocaml switch (where I guess "currently" means whenever the lock file was generated?), but where is that information stored?

@olynch
Copy link
Contributor Author

olynch commented Nov 27, 2024

The flake takes the ocaml build constraint from the dune file.

Basically, the flake "resolves" the dependencies using the version of ocaml-repository that is pinned in the lock file, which comes from the input:

    opam-repository = {
      url = "github:ocaml/opam-repository";
      flake = false;
    };

If you want to add version bounds, you can do so in the dune file, and that will inform the resolution algorithm. But as long as the dune file and the git sha256 of opam-repository stay the same, the same versions will be resolved.

@mikeshulman
Copy link
Owner

So it will use 5.2.0?

It would be nice if the dune file could say that 5.2.0 is allowed, but if the distributed development builds could nevertheless use a more recent version like 5.2.1 to take advantage of bugfixes.

@olynch
Copy link
Contributor Author

olynch commented Nov 28, 2024

Yes, it currently uses 5.2.0. Version 5.2.1 has not been added to nixpkgs yet, see NixOS/nixpkgs#359654. In general, I believe that the (>= 5.2.0) line will have your intended behavior; it will default to newer versions as they become available.

@mikeshulman
Copy link
Owner

How much of a delay is there usually for an ocaml release making it into nixpkgs?

@olynch
Copy link
Contributor Author

olynch commented Dec 2, 2024

Empirically, it seems like around two weeks, as the 5.2.1 release just got merged.

@mikeshulman
Copy link
Owner

It would be nice to document somewhere (e.g. for the benefit of future-me) the command that has to be run to update the lock file and when that should be done. The README doesn't seem like quite the right place, but I suppose it would be okay for now. Or maybe the CONTRIBUTING file (which I just made for the first time, now that we're starting to get contributions from more than just me). Thoughts?

@mikeshulman
Copy link
Owner

This is ok to merge, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants