cashapp / hermit

🐚 Hermit manages isolated, self-bootstrapping sets of tools in software projects.
https://cashapp.github.io/hermit
Apache License 2.0
600 stars 52 forks source link

feat: support extending a parent environment #398

Closed jvmakine closed 8 months ago

jvmakine commented 8 months ago

Adds a new environment configuration to bin/hermit.hcl

inherit-parent = true

Setting this inherits the Hermit environment from a parent directory, inheriting environment variables and packages.

This should be useful in larger monorepos where we want to have a single root environment with most tooling, but want to still allow subprojects to have their own owerwrites and environment variables.

Note, the packages in parent environment won't have access to the child environment even when being called from the child environment. This means that any package calling another package in the parent environment will still call the parent package even if that is overwritten in the child environment. Though this can be potentially confusing, it should give more consistent behaviour between parent and child environments. Also, package dependencies can not cross environments. So, it is not possible to have a package dependency from a child environment package to a parent environment package.

Finally, for the time being, all hermit operations apply only to the currently active environment. So, it is not possible to upgrade, install, or uninstall parent packages from the child environment