asdf-elixir
asdf-elixir copied to clipboard
Feature Request: Automatically reshim after a mix escript.install command successfully finishes
The current Livebook instructions say that if you're using asdf you need to run asdf reshim elixir after installing livebook as an escript:
Running Livebook using Escript makes for a very convenient option for local usage and provides easy configuration via CLI options.
mix escript.install hex livebook # Start the Livebook server livebook server # See all the configuration options livebook server --helpAfter you install the escript, make sure you add the directory where Elixir keeps escripts to your $PATH. If you installed Elixir with
asdf, you'll need to runasdf reshim elixironce the escript is built.
Source: https://github.com/elixir-nx/livebook/blob/26226a42e0544fe3870c29bc68d752e7d6d3e63c/README.md#escript
Is it possible for asdf-elixir to detect that asdf escript.install has successfully installed an escript and then automatically reshim? If not that's fine, just figured I'd ask to remove a potential stumbling block. Escripts are always executable binaries so reshiming makes sense (to me). We'd probably have to do it when uninstalling an escript as well.
Yeah I have stumbled upon the same thing as well. I installed livebook and the command wasn't in the $PATH until I ran reshim command.
Yes, this has bit me too. Seems like a general problem asdf has with additional binaries. For instance, something very similar happens with node.js and npm: https://asdf-vm.com/manage/core.html#reshim.
This project clearly says in the README that you should reshim after building escripts. But it's still easy to miss until you learn the hard way. Rebuilding the escripts path seems easy enough, but it's not obvious to me how to trigger that. Any idea?
I'm not entirely sure how the reshim thing works, and if it takes into consideration just the existence of the binaries or also is needed when binary file changes, but it seems like the easiest thing to do would be to
- list the binaries before running the command, possibly with their checksums if that's important
- list the binaries after running the command, again possibly with checksums
- see if the paths changed
What we probably don't want to do is to run it after each and every command out there, but only limit it to things that can affect the binaries, so in this case "mix" command that's a binary itself in the bin/ path of Elixir installation...
I don't know, this is not trivial.
@axelson @kamidev @hubertlepicki, I don't have time to work on this myself right now, but a PR would be welcome. I think the asdf-nodejs plugin does something along these lines with the custom npm shim - https://github.com/asdf-vm/asdf-nodejs/blob/master/shims/npm That npm shim may not be working at the moment, but it should be possible to do something similar and get it working for mix deps.get.
I'll take a look at this. Perhaps a separate shim for escript would be enough? Or is there a reason we need to check mix deps.get, too?
I don't think we need to reshim after a mix deps.get because that won't add any global binaries. I think we'd only need to automatically reshim after mix escript.install and mix escript.uninstall.
That's what I was thinking, too. I am playing around trying to get a forked project with an 'escript' shim (based on the npm example above) to run. I'll keep you updated if I make any progress.
Sounds good!
On Sat, Oct 30, 2021 at 8:31 AM Kami Development @.***> wrote:
That's what I was thinking, too. I am playing around trying to get a forked project with an 'escript' shim (based on the npm example above) to run. I'll keep you updated if I make any progress.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/asdf-vm/asdf-elixir/issues/103#issuecomment-955574298, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAACN5OBA6Y7UON6WOQEMF3UJRBZRANCNFSM45TBMUKQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.