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

esy: init at 0.6.2 WIP #85835

Closed
wants to merge 2 commits into from
Closed

esy: init at 0.6.2 WIP #85835

wants to merge 2 commits into from

Conversation

NickHu
Copy link
Contributor

@NickHu NickHu commented Apr 23, 2020

Motivation for this change

A work-in-progress packaging of the esy package manager, by building on #65098 and esy/esy#994.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Issues to be solved

While the binary seems to work fine, there are some issues. The largest of which is that esy doesn't seem able to compile ocaml (under NixOS), which I think will be resolved when esy-ocaml/ocaml@1667562 hits the npm package registry (I tried really hard to just use local version of esy-ocaml/ocaml, switching to the latest 4.8.1000+esy branch, and editing the package.json of what I was trying to compile, but this just made the dependency resolver scream at me - I think it's very broken). As a result, I was unable to get this build of esy to build a single package (as it first needs to bootstrap the ocaml compiler), suggesting that more work is needed.

esy version 0.6.4 is out, but using this version causes complaints about esy.lock being corrupt on everything I tried - initially, I thought this was just that the format of esy.lock changed in a non-compatible way, but strangely when I tried version 0.6.4 on Arch Linux (by updating the PKGBUILD on the AUR) and it had no such issue. Fortunately, 0.6.2 doesn't seem to invalidate existing esy.lock directories. I wasn't able to package 0.6.3 easily because its package.json doesn't seem to be on the npm registry.

It might also be necessary to get some binaries (gnum4, coreutils, etc.) into the PATH used by esy when it builds too, but adding this to buildInputs/propagateBuildInputs doesn't seem to work (though strangely when I ran esy inside nix-shell -p gnum4 it was somehow able to find m4).

cc @Zimmi48 @kamilchm @anmonteiro

Zimmi48 and others added 2 commits April 23, 2020 01:52
Aborted attempt to add the esy package manager to nixpkgs.  I think I
was almost there to get its dependencies, but I have no idea if
building it like a dune package would have been enough to make it
work.  The last hurdle has been with cudf and dose3.  The first
problem when building dose3 was a string-byte problem, fixed by
importing patches from the opam repository.  I don't know how to fix the
next one: dose3 attempts to find a cudf.cmxa in a folder that contains
a cudf.cma but no cmxa.

This submission is in the hope that this PR can be partially salvaged
and my work was not totally useless.
Following on from PR NixOS#65098, this commit makes dose3 compile (all that
was missing was to compile the native version of cudf), and also esy.
Various packages have been updated too, and esy's node dependency
esy-solve-cudf has been packaged. A new overlay is added for
esyOcamlPackages, as mainline cmdliner doesn't successfully compile esy.
It's anticipated that more esy-specific deviations might occur.

Most of these changes were taken and adapted from
esy/esy#994.
@xavierzwirtz
Copy link
Contributor

I tried setting this up in an fhs user env, looks like it got esy-ocaml compiling. Its getting farther along, but failing due to dune's build trying to call out to ocaml. Feels like something is preventing the built esy-ocaml from getting put on the path.

info esy 0.6.6 (using package.json)
info building @opam/ocamlbuild@opam:0.14.0@6ac75d03
info building @opam/jbuilder@opam:1.0+beta20.2@053ddcf2
info building @opam/ocamlfind@opam:1.8.1@ff07b0f9
info building @opam/dune@opam:2.1.3@8a848ab8
error: build failed with exit code: 1
  build log:
    # esy-build-package: building: @opam/dune@opam:2.1.3
    # esy-build-package: pwd: /home/xavier/.esy/3/b/opam__s__dune-opam__c__2.1.3-50f7540b
    # esy-build-package: running: 'ocaml' 'bootstrap.ml' '-j' '4'
    esy-build-package: unable to resolve command: ocaml

  building @opam/dune@opam:2.1.3
esy: exiting due to errors above

@xavierzwirtz
Copy link
Contributor

With the latest changes in https://github.com/xavierzwirtz/nixpkgs/tree/esy I am able to compile and run hello-reason and esy with this derivation. I had to remove esy/esy#988 from the derivation, it was causing the path in the esy sandbox to not include any of the paths esy injects.

@lobre
Copy link
Contributor

lobre commented Aug 20, 2020

@xavierzwirtz, does it mean this PR gets closer to not being a draft anymore?

@xavierzwirtz
Copy link
Contributor

@lobre, yes, with my changes esy looks to be working properly. Since its using an fhs user env, all of the opam packages that hardcode to using /bin/bash just work. I can get this PR squashed into a clean commit and re-pr.

@lobre
Copy link
Contributor

lobre commented Aug 23, 2020

@xavierzwirtz, that would be great! I'd love to try building onivim2 (onivim/oni2#2311) once merged.

@xavierzwirtz xavierzwirtz mentioned this pull request Aug 25, 2020
10 tasks
xavierzwirtz added a commit to xavierzwirtz/nixpkgs that referenced this pull request Sep 2, 2020
Following on from PR NixOS#65098, this commit makes dose3 compile (all that
was missing was to compile the native version of cudf), and also esy.
Various packages have been updated too, and esy's node dependency
esy-solve-cudf has been packaged. A new overlay is added for
esyOcamlPackages, as mainline cmdliner and angstrom doesn't successfully
compile esy. It's anticipated that more esy-specific deviations might
occur.

Most of these changes were taken and adapted from
esy/esy#994 and
NixOS#85835

Co-authored-by: Xavier Zwirtz <me@xavierzwirtz.com>
@stale
Copy link

stale bot commented Jun 4, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 4, 2021
@SuperSandro2000
Copy link
Member

Closing due to inactivity from author.

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

6 participants