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

WIP: ocaml: Export mkOcamlPackages again (and a question) #98472

Closed
wants to merge 1 commit into from

Conversation

hakuch
Copy link
Contributor

@hakuch hakuch commented Sep 22, 2020

This change is motivated by my wish to create a development environment for OCaml with a version of the OCaml compiler with additional features enabled (like the Flambda optimization engine, or support for American Fuzzy Lop).

If I understand correctly, mkOcamlPackages was previously exported, but then that change was reverted. See the commit message for more details.

Before this PR is considered for merging, I have a question which I think needs to be addressed.

I have a file shell.nix in my project directory that I would have assumed to accomplish my goals, but I get the following error about a missing version attribute and I'm not sure why:

$ nix-shell
error: attribute 'version' missing, at /home/jhaberku/src/nixpkgs/pkgs/top-level/ocaml-packages.nix:1020:32
(use '--show-trace' to show detailed location information)

(In the "real" shell.nix I'm using a separate clone of nixkgs under the hakuch name, but that's not important here.)

I don't understand why the ocaml record doesn't have the version attribute in this context.

Here's the shell.nix file:

let
  pkgs = import <nixpkgs> {};
  
  ocaml = pkgs.callPackage <nixpkgs/pkgs/development/compilers/ocaml/4.11.nix> {
    flambdaSupport = true;
  };
  
   ocamlPackages = pkgs.ocaml-ng.mkOcamlPackages { inherit ocaml; };
in

pkgs.mkShell {
  buildInputs = [
    ocaml
    pkgs.ocamlformat
  ] ++ (with ocamlPackages; [
    dune_2
    findlib
    ppx_expect
    odoc
    utop
  ]);
}

@hakuch
Copy link
Contributor Author

hakuch commented Sep 22, 2020

@vbgl , do you perhaps know what's going wrong?

@hakuch hakuch requested a review from vbgl September 22, 2020 14:31
0a6ec88 exported `mkOcamlpackages`,
which is useful for instantiating all OCaml packages with a different
version of the OCaml compiler (for example, one with flambda enabled).

9211bcc undid this change, perhaps
unintentionally, as part of other refactoring.
@vbgl
Copy link
Contributor

vbgl commented Sep 22, 2020

Regarding the initial motivation, there is related documentation in the wiki: https://nixos.wiki/wiki/OCaml#Custom_version

@hakuch
Copy link
Contributor Author

hakuch commented Sep 22, 2020

Thanks, @vbgl! I haven't previously encountered lib.makeScope. I should have looked at the PR for 9211bcc, since it had information not included in the commit message itself (which I found with git log).

The conclusion is that that mkOcamlPackages shouldn't be re-exported because its functionality is provided by overrideScope'.

@hakuch hakuch closed this Sep 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants