Nix is a powerful package manager for Linux and other Unix systems that makes package management reliable and reproducible. Nix in SStack was containerized by Apptainer for portability.

For more information see Nix official website. For more tutorials see Nix documentation.

How to Install Nix?

You can use the SStack tool to install Nix to manage software on discovery.

For example, to install Nix stack named 2023A in your home directory, run command:

sstack install -t nix -n 20243

This creates a module file that you can load in your environment to be able to use the stack to manage software, as shown in the following:

module use /fs1/home/username/sstack/rhel_8/modules/
module load nix/2023A

To check if Nix was installed successfully, run:

nix --version

This shows the version of Nix was installed.

nix (Nix) 2.17.0

How to Remove Nix

If you decide to remove a Nix stack type, you can simply do that by using the sstack remove command.

sstack remove -t nix -n <stack-name>

For example, to remove the installed Nix stack in the previous section 2023A, you simply run:

sstack remove -t nix -n 2023A

If you would like to remove a stack that was installed in the HOME directory, you have to specify the location using -p flag.

Make sure that the sstack module is loaded before removing a stack type.

After you uninstall a stack, all installed software within that stack will be removed, and you won’t be able to use them anymore.

Every software installed using Nix are read only. This means that you can’t remove Nix stack types using rm command unless you change the permissions and make all the files in the stack writable.

How to Use Nix to Manage Software?

After you get Nix installed you can use it to manage software on Discovery. Please refer to Nix