Tool like python poetry or elixirs mix that makes use of exhaustive lockfiles?

The message is telling you the issue in this case. You need to commit the changes to have opam pick them up (if you want to have it pick up uncommitted changes, you need to use the --working-dir option when pinning)

Hmmm… Ist there no way to have it see the changes without a commit? I prefer to add and use in one commit rather than split those up.

Not even sure yet if that what I want is actually possible and just playing around with a temporary added dependency…

I grew up in ecosystems where that is easily possible, without affecting the system state (beyond some megabytes more in some cache folder).

Just realising that you already told about the switch… Where do I need to put it? The install command or the pin? Can’t test right now, as I’m already on my way to bed.

If you want to publish your work on opam then obviously you need a correctly functioning opam package file for it which states its dependencies. But if you just need to install your project’s dependencies in order to get on with developing that project, then why not just run ‘opam install …’ for the dependencies that you know that your project has?

1 Like

I edited my comment to include that. There is a working dir (-w) option, I think it is enough to use it when pinning or maybe when installing the dependencies but I never used it so you may need to refer to the help pages or the manual for it

1 Like

Because it feels like specifying things multiple times? Why do I have to specify it on the terminal if it could easily be interred from the project description file?

You are a hard man to please. Anyway you have received a separate response on how to deal with that.

Not hard to please just hard to get out of habits :wink: I’m open to the language, though the ecosystem is really tough for me, as I grew up with sandboxes and isolated dev environments.

But thanks for your help, I really appreciate it.

Can you explain? I.e., can you show what commands you ran and what didn’t work exactly? From what I know about Nix, it should be able to install a package like NodeJS with something like nix-env install node (I don’t remember the command exactly) which creates a new Nix generation where the node and npm commands are available. After that you can use node to install esy as I outlined above.

If you are concerned about installing Esy in a global path it’s fairly simple to change the install path to somewhere under your home directory: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally#manually-change-npms-default-directory

Anyway, that is all one-time setup, after which you have Esy and get lockfiles and build artifact cache and all the good stuff.

EDIT: https://nixos.org/nixos/packages.html?attr=nodejs&channel=nixos-20.03&query=nodejs

Esy doesn’t work in NixOS even if packaged, because it relies on the ability to fetch and build dependencies outside of the nixpkgs repository. As one might expect, many system dependencies are either not correctly specified or not specified at all, which leads to a pretty bad experience.

So here’s my proposal: if you’re on NixOS why not rely on nixpkgs itself? it has a subset of the packages present in OPAM but my experience has been that you can just add your own overlays or help package more OPAM packages into Nix.

For examples, I’d encourage you to look in shell.nix and the nix/ folder in e.g. this repo: https://github.com/anmonteiro/piaf

P.S.: I maintain a list of my own overrides here, which contain either packages that I’m staging there before submitting to nixpkgs, or forks of otherwise unmaintained OCaml packages.

2 Likes

How I installed it, is not really relevant, fact is, that esy is precompiled and refers to interpreter /lib64/ld-linux-x86-64.so.2. Though nixOS does not have that global interpreter. I had to manually path the files.

Because it becomes tedious to do that :smiley: Though indeed, as opam2nix doesn’t work for me, and I really want to have reproducability between my systems, this is probably my only option.

Thank you all.

Ah, I see, fair enough. If only Esy was packaged on Nix :smiley:

If only esy could generate nix derivations … :wink:

1 Like

You probably need to open an issue in opam2nix or ask the author (@timbertson) directly.

1 Like

Thanks for putting your example in a repo. I got the same result, figured out you’re using the latest release, which is from ~6 months ago. I’ve gotten a bit lazy cutting releases, the current v1 branch works if you update your sources.json to use that. I’ve cut a new release now, but in general I’d recommend just tracking the v1 branch.

(I won’t necessarily see updates on this thread, you should always feel free to open an opam2nix issue if something’s not working!)

1 Like

I did have a brief attempt at an esy2nix built on opam2nix (GitHub - timbertson/esy at esy2nix). But I didn’t get very far along figuring out how to repurpose the esy code. I was only interested in one esy package anyway (onivim), so for that esy was good enough :man_shrugging:

I assume you got Esy to work on NixOS? How so?

No, I didn’t. I have an idea to get it working, though not the time to actually try it.

Perhaps during the weekend.

Sorry, I was replying to Tim.

1 Like

Afraid not, I just run Nix on Fedora. I try to manage most of my stuff though nix, but using a boring distro is a nice escape hatch for stuff like this.

1 Like