How do I create personal module files I can load in?

I have installed some of my own software into my /projects directory and would like to make it available using the “module avail” command. How do I create my own module files on the CURC system?

You will need to generate a simple module file for your application. Its probably easier to copy a module file set up by the administrators instead of make one from scratch. Lets use the cmake module to get ourselves a template:

[datr2651@shas0137 ~ ] $ module show cmake > your_software.lua

Running this command should get you a basic lua script to modify called your_software.lua. Printing this to our terminal we will see…

[datr2651@shas0137 ~ ] $ cat your_software.lua
------------------------------------------------------------------------------------------------------------
   /curc/sw/modules/idep/cmake/3.20.2.lua:
------------------------------------------------------------------------------------------------------------
setenv("CURC_CMAKE_ROOT","/curc/sw/cmake/3.20.2")
setenv("CURC_CMAKE_BIN","/curc/sw/cmake/3.20.2/bin")
help([[CMake is an extensible, open-source system that manages the build 
process in an operating system and in a compiler-independent manner.
]])
whatis("Name            : cmake")
whatis("Version         : 3.20.2")
whatis("Module          : cmake/3.20.2")
whatis("Category        : development")
whatis("Keyword         : build")
whatis("URL             : http://www.cmake.org/")
whatis("License         : BSD")
whatis("Description     : Cmake")
whatis("Prefix          : /curc/sw/cmake/3.20.2")
prepend_path("PATH","/curc/sw/cmake/3.20.2/bin")

The main things we care about changing is the prepend_path() function. This should point to your application’s executable files. If your application requires any libraries to run then add an additional prepend_path() function at the bottom of the script with the parameters: “LD_LIBRARY_PATH”, and a path to any directories containing the required library.

We can also remove the setenv() functions at the top of the script because these are ease of use variables for the package we copied from. The rest of the fields can be adapted but these are mostly metadata

Once your file is complete. Run module use on the directory that contains your new module and you should be set.