stefan-hoeck / idris2-pack

BSD 3-Clause "New" or "Revised" License
105 stars 27 forks source link

Support builds without network access #273

Open jalil-salame opened 10 months ago

jalil-salame commented 10 months ago

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

Conclusion

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

buzden commented 10 months ago

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?

jalil-salame commented 10 months ago

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.

buzden commented 10 months ago

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?

jalil-salame commented 10 months ago

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:

stefan-hoeck commented 10 months ago

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.

jalil-salame commented 10 months ago

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