stefan-hoeck / idris2-pack

BSD 3-Clause "New" or "Revised" License
90 stars 23 forks source link

Manage/use local build of Idris2? #274

Closed sebeaumont closed 5 months ago

sebeaumont commented 5 months ago

Is there a way to have pack use a local build of Idris?

I am happy building and installing Idris from a local repo and would like to manage that independently as well as use the good work here to leverage all the curated libraries/packages.

I also think the install.bash script might not work for MacPorts users -- but I could add a similar CPATH setting by detecting /opt/local/include as well as /opt/homebrew as currently, (or search for gmp.h in either location?)

But given I've built locally that step should be unnecessary in this case; Is there a way to tell the installer to just use the local one in ~/.idris2?

And/or would it be possible then to do pack switch to a local Idris repo just like other packages?

buzden commented 5 months ago

Well, there is a way to use local Idris, but it is slightly more subtle than you describe.

You cannot switch to a local compiler, because switch takes a collection and obviously there is no such a collection that uses a local compiler.

But what you can do is to use a local pack.toml configuration file and to set an alternative compiler for a particular dir/project. You can see an example of that here.

You can use a local dir as a URL, and you can set commit field to track a particular branch instead of a commit -- it is documented.

But what your night not expect on this setting is that pack won't reuse the build dir of that given local location. I.e. being fed an alternative compiler, it will copy the sources it to the pack's local storage for compiler's sources and will build it there.

sebeaumont commented 5 months ago

@buzden Thanks for the explanation of how it works and pointer on how to do it.