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 in guide fails #191

Open
agj opened this issue Oct 6, 2024 · 2 comments
Open

Nix flake in guide fails #191

agj opened this issue Oct 6, 2024 · 2 comments

Comments

@agj
Copy link

agj commented Oct 6, 2024

Hello! This is my first time trying out Melange and OCaml. I'm following the "getting started" guide, tried the Nix flake, copied and pasted literally, and I get the following error output:

warning: Git tree '/Users/Ale/mydata/personal/interactive/other/userscripts' is dirty
error: builder for '/nix/store/gp5c6abv82fvxgi5xncj0xv7x5dbkp6l-ocaml5.1.1-melange-dev.drv' failed with exit code 1;
       last 10 log lines:
       > Running phase: configurePhase
       > no configure script, doing nothing
       > Running phase: buildPhase
       > File "vendor/dune", lines 39-40, characters 3-54:
       > 39 |    annot
       > 40 |    (:include ../gen/optional_5_2_modules.txt))))
       > Error: The following modules must be listed here as they don't have an
       > implementation:
       > - Value_rec_types
       >
       For full logs, run 'nix log /nix/store/gp5c6abv82fvxgi5xncj0xv7x5dbkp6l-ocaml5.1.1-melange-dev.drv'.
error (ignored): error: cannot unlink '/private/tmp/nix-build-ocaml5.1.1-ocamlc-loc-3.16.0.drv-3/dune-3.16.0/src': Directory not empty
error (ignored): error: cannot unlink '/private/tmp/nix-build-ocaml5.1.1-chrome-trace-3.16.0.drv-3/dune-3.16.0/test/blackbox-tests/test-cases': Directory not empty
error: 1 dependencies of derivation '/nix/store/k9nai3rfzllccw2ah6qbv9jxl9dbzkgh-nix-shell-env.drv' failed to build

System info:

 - system: `"x86_64-darwin"`
 - host os: `Darwin 21.6.0, macOS 10.16`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.18.8`

Any help would be appreciated! 🙏

@anmonteiro
Copy link
Member

Hey @agj, that flake.nix does seem outdated, as we've since included a submodule which Nix doesn't clone.

In the meantime, I'd recommend this one:

{
  description = "Melange starter";

  inputs = {
    flake-utils.url = "github:numtide/flake-utils";
    nixpkgs.url = "github:nix-ocaml/nix-overlays";
  };

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = nixpkgs.legacyPackages.${system}.extend
          (self: super: { ocamlPackages = super.ocaml-ng.ocamlPackages_5_2; });
        inherit (pkgs) ocamlPackages;
      in

      {
        devShells.default = pkgs.mkShell {
          nativeBuildInputs = with ocamlPackages; [
            ocaml
            dune_3
            findlib
            ocaml-lsp
            melange
          ];
          buildInputs = [ melange ];
        };
      });
}

I'm also going to move this issue to the website repo to make sure we update it there. Thanks again.

@anmonteiro anmonteiro transferred this issue from melange-re/melange Oct 6, 2024
@agj
Copy link
Author

agj commented Oct 26, 2024

Thank you, @anmonteiro ! That works if I add with ocamlPackages; to the buildInputs line. At least so far, I still have to start writing code, haha. Wish me luck.

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

No branches or pull requests

2 participants