idris2-pack icon indicating copy to clipboard operation
idris2-pack copied to clipboard

Support builds without network access

Open jalil-salame opened this issue 1 year ago • 6 comments

Issue

I am trying to package idris2-pack for nix so I can easily access idris2-pack from NixOS. nix does not allow network accesses during the build process; you need a fetch step, where all dependencies are fetched, then a build step.

Solution

Do not access the network during builds by having a fetch script that clones idris2 and idris2-pack-db, then the build only accesses them and does not need to fetch them.

Alternatives considered

  • Do not build with nix (status quo)
  • Fetch the dependencies after building pack (Using the os's idris2 compiler)

Conclusion

This seems like a nice project for me to start learning idris, would you be open to such contributions?

jalil-salame avatar Dec 26 '23 15:12 jalil-salame

This seems like a nice project for me to start learning idris, would you be open to such contributions?

I'm not the project author, but I'm sure such contribution would be considered unless it breaks existing workflow. I personally think that the ability of separate fetching and building is good. As an example, I use this sometimes in the Gentoo build system, when I need to build something big without an internet connection, I fetch sources first, when I have a connection, and then I can build the stuff without.

Having said that, I still don't understand your proposition. I mean, when I do pack build my-lib, at which point would you split fetching the dependencies and the build process? Or, do you propose this split between fetching and building only when you are talking about updates like pack switch?

buzden avatar Dec 26 '23 15:12 buzden

Having said that, I still don't understand your proposition. I mean, when I do pack build my-lib, at which point would you split fetching the dependencies and the build process? Or, do you propose this split between fetching and building only when you are talking about updates like pack switch?

When building pack itself c:

Currently the Makefile fetches idris which is easy to patch out, but micropack tries to access/download at least one git repo.

jalil-salame avatar Dec 26 '23 15:12 jalil-salame

So are you talking about micropack only, or about pack update command too?

Are you talking only about those two cases, or potentially about some more commands, like pack switch and/or pack build?

buzden avatar Dec 26 '23 15:12 buzden

So are you talking about micropack only, or about pack update command too?

Are you talking only about those two cases, or potentially about some more commands, like pack switch and/or pack build?

Just micropack for now, I am in the process of getting idris2 set up so I can learn how to use it c:

jalil-salame avatar Dec 26 '23 15:12 jalil-salame

If this is only about building and installing the pack application under nix, I suggest to not use micropack but write something similar to our installation script. This will make it straight forward to separate fetching all necessary libraries (plus Idris itself) from building the whole thing.

stefan-hoeck avatar Dec 27 '23 15:12 stefan-hoeck

If this is only about building and installing the pack application under nix, I suggest to not use micropack but write something similar to our installation script. This will make it straight forward to separate fetching all necessary libraries (plus Idris itself) from building the whole thing.

The installation script looks easy to replicate in nix. I will see how far I can go with just that.

My main worry is that pack is inside PACK_DIR and it would be a problem for it to be outside the pack dir.

My knowledge comes from Rust, where rustup can either be installed to the system and fetch the tool chain (compiler, formatter, etc) to .rustup or the install script installs it to .rustup/bin, and then you have cargo (the package manager) that can also be installed system wide or to .rustup/bin and it installs binaries to .cargo/bin

jalil-salame avatar Dec 27 '23 16:12 jalil-salame