Newer
Older
This simple utility program allows creating [environment modules](https://modules.readthedocs.io/en/latest/index.html) suitable for HPC from a Nix Flake.
The module aims to be as transparent as possible to the user, i.e. it should not require any additional configuration or setup and Nix internals are well hidden.
## Installation
The package is written in Haskell and can be built with standard Haskell tooling (hopefully on all supported operating systems) and also via Nix.
### Standard Builds
Obtain the Haskell toolchain via GHCup and follow their instructions.
All defaults in the installer should be fine.
Install the program using cabal
```bash
cabal install --installdir=$HOME/.local/bin
```
or another directory of your choice.
### Nix
The project can be used as a Nix Flake.
The flake also provides and overlay for nixpkgs.
E.g. run the executable and get some help.
```bash
nix run git+https://git.uni-jena.de/mi24ris/MakeNixModule --help
```
### Static Executable
The CI pipeline also builds a static executable for Linux.
You can download it from the CI pipelines as an artefact.
## Usage
The program generates an environment module from a Nix flake.
The flake attribute to use is specified via `--package`, e.g. `--package=nixpkgs#nwchem` to generate a module for the NWChem package in nixpkgs.
This argument must be specified.
The module file and a symlink into the Nix store are generated below `--rootdir=$ROOTDIR`.
This output link into the Nix store prevents the expression from being garbage collected and should only be deleted together with the module, if you want to remove both.
The `--rootdir` argument is optional and defaults to the current directory.
The module will be generated by default at `$ROOTDIR/modules`, but the directory name below `$ROOTDIR` can be overridden via `--moddir`.
The Nix expression will be generated at `$ROOTDIR/nix-software`, but the directory name below `$ROOTDIR` can be overridden via `--nixdir`.
**WARNING**: This program passes `--accept-flake-config` to all nix evaluations.
Be sure to trust the target flake.
### Example
Generate an environment module for the [Psi4](https://psicode.org/) quantum chemistry program, where the Nix package is provided by [Nix-QChem](https://github.com/Nix-QChem/NixOS-QChem).
```bash
MakeNixModule --package=github:Nix-QChem/NixOS-QChem#psi4 --rootdir=/cluster
```