These instructions are valid for a current Arch Linux installation, since that’s what i’m using. Some details might differ on other distributions.

Installation

Install env-modules package from AUR:

(I use trizen to manage AUR packages, but that’s just personal preference)

trizen -S env-modules

There’s also env-modules-tcl, but i had some problems with that, so i stayed with env-modules.

Setup

Create $HOME/.modulefiles:

mkdir $HOME/modulefiles

Add this snippet to your .bashrc:

 #add own modules to modulepath
if [ -d $HOME/.modulefiles ]; then
    module use $HOME/.modulefiles
fi

Reload .bash

source .bashrc

Example module file

Create ‘hello’ module file:

touch $HOME/.modulefiles/hello

Open $HOME/.modulefiles/hello with your editor and insert this:

#%Module1.0######################################################################
##
## helllo modulefile
##
proc ModulesHelp { } {
    puts stderr "\t'hello world' for demo purposes"
}

module-whatis   "sets HELLO to 'hello world'"

You should see the new module file now when you run “module avail”:

$ module avail
------------------------------------- /home/flart/.modulefiles --------------------------------------
hello

(Other directories in your module path might also show up here)