How do I use local XSPEC models

Sharing this question from a user in case others run to the same issue:

I am running XSPEC in the terminal of Fornax’s JupyterLab. I am attempting to use the model relxill for spectral fitting. From my understanding, relxill is not one of the preconfigured models, so I uploaded the necessary files and tried to configure relxill. When I do this, I get an error stating that gmake is not found.
I am wondering if there is a simpler way to implement relxill within Fornax. Please let me know when you get the chance!

Generally, to compile XSPEC local models, like relxill, you need to install add the xspec-compilers package after activating the heasoft environment (see HEASoft docs). These are the steps that are needed from the terminal:

micromamba activate heasoft
micromamba install "xspec-compilers=12.15.1" -c https://heasarc.gsfc.nasa.gov/FTP/software/conda -c conda-forge -y

Then run the compile command for the model.

Currently there is bug in xspec-compilers that will be fixed by the HEASoft team, to get around it for now, do the following before the compile command:

Edit the file: /opt/envs/heasoft/heasoft/bin/hmakerc
And replace the line:
MAKE="gmake"
With:
MAKE="make"

Then run the compile command.

Additionally, to have the models persist between Fornax sessions, do the above in a folder in your home directory: e.g. ~/xspec-models/

Then, tell xspec to use it by editing: ~/.xspec/Xspec.init, and setting (and uncommenting) the line:

LOCAL_MODEL_DIRECTORY: ~/xspec-models

Then load the model the usual way inside xspec with: lmod relxill.