Zulip Chat Archive

Stream: lean4

Topic: Envvar dependency path


Leni Aniva (May 06 2025 at 22:01):

Is it possible to use an environment variable as the path to a dependency in lakefile.{toml,lean}, as opposed to a git hash?

Mac Malone (May 17 2025 at 22:14):

I am not quite sure what you mean. Perhaps require ... from run_io IO.getEnv "PKG_PATH" would do what you want in lakefile.lean?

Leni Aniva (May 19 2025 at 20:36):

Mac Malone said:

I am not quite sure what you mean. Perhaps require ... from run_io IO.getEnv "PKG_PATH" would do what you want in lakefile.lean?

this is perfect

Leni Aniva (May 19 2025 at 20:36):

wouldn't this interfere with the lock file?

Mac Malone (May 19 2025 at 21:16):

Yes. One would need to run lake -R update <env-pkg-name> whenever the locked path should change.

Leni Aniva (May 19 2025 at 21:16):

well this couldnt be used with nix then

Mac Malone (May 19 2025 at 21:18):

It is also possible to just remove the environment-dependent dependency from the lockfile-- then it will always follow the configured path. The configuration itself is also cached, so Lake would need to be run with lake -R whenever it should recheck the enviroment (by reconfiguring).

Mac Malone (May 19 2025 at 21:21):

(The reason for all this caching is that Lake is aiming for eproducible builds and thus attempts to avoid dynamic, shifting state.)


Last updated: Dec 20 2025 at 21:32 UTC