Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Proposal: mechanism for doing environment setup #312

Open
alecthomas opened this issue Sep 6, 2022 · 4 comments
Open

Proposal: mechanism for doing environment setup #312

alecthomas opened this issue Sep 6, 2022 · 4 comments

Comments

@alecthomas
Copy link
Collaborator

Hermit currently performs no custom actions on environment activation.

However, it is not uncommon to want to perform additional tasks within an environment before it becomes usable, beyond just installing the package. Some examples of this are creating a .venv for Python, perhaps running rustup to install a Rust toolchain, and so on.

Probably the simplest approach is to allow hooks in bin/hermit.hcl, eg.

// Run once on environment "initialisation", whatever that means? This concept does not exist yet.
on setup {
  run { command = "..." }
}

// Run on every activation? Is that a good idea?
on activate {
  run { command = "..." }
}
@quad
Copy link
Collaborator

quad commented Sep 6, 2022

I'm OK with an on activate; we should make clear in the documentation that potentially happens a lot, so anything here needs to run fast.

What happens in the case of failure? Right now, when a trigger fails, there's not much in the way of logging. At least I find them hard to debug.

@alecthomas
Copy link
Collaborator Author

Yeah I think that is a bug we should fix :(

@fmr
Copy link

fmr commented Sep 7, 2022

How do I upvote this? Anyway, I upvote ⬆️ for all it's worth 😄

@damienrj
Copy link
Contributor

damienrj commented Oct 1, 2022

on activate makes a lot of sense. I think the speed is less of an issues as long as it is transparent that it is doing something. Alternatively on setup could basically be on first activation which would also be a nice option if users are doing something slowly. HERMIT_ACTIVATED for example could be set.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants