spack
spack copied to clipboard
Documentation: how to create (tcl/lmod) module for a Spack environment
Assume you have a Spack environment defined via
spack:
concretization: together
view: true
packages:
all:
compiler: [[email protected]]
specs:
- package1
- package2
What else needs to be defined so that Spack creates a (one) module that will set up the user's environment using Spack's environment's view? I don't want to generate a tcl/lmod module for each installed package, just for the Spack's environment's view.
I too would appreciate such a feature but I believe it doesn't exist yet. One could easily hack together a script to create such a modulefile from the generated loads file from an environment, but Spack directly creating this file would be better.
Especially important in light of #26804 (see workaround given there).
I think this makes sense, especially with concretization: together.
If you don't want to wait for module files you can do spack env activate --sh > env.sh and source env.sh.
Got any news on that? I'm trying to understand at what depth I need to work for a PR, and noticed this: https://github.com/spack/spack/blob/0f26931628bf6485b07ffe4611eb1ef3cec2c8c7/lib/spack/spack/hooks/module_file_generation.py#L43
Does that mean that env_write actually generate module files?