Custom Spack Packages
Spack can manage custom executables. The example below creates a simple hello-world package:
- Create an executable
mkdir -p /tmp/dummy-bin && cat > /tmp/dummy-bin/hello-world << EOF #!/bin/bash echo "Hello from my custom binary managed by Spack!" EOF chmod +x /tmp/dummy-bin/hello-world
- Pack the executable
tar \ -czf /tmp/dummy-software-1.0.tar.gz \ -C /tmp/dummy-bin \ hello-world
- Create a local Spack repository
mkdir -p /opt/spack/repos && spack repo create \ /opt/spack/repos/local_repo \ local_repo && spack repo add \ /opt/spack/repos/local_repo/spack_repo/local_repo
- Copy the archive hash
sha256sum /tmp/dummy-software-1.0.tar.gz
- Create a package file
spack create \ --name dummy-software \ file:///tmp/dummy-software-1.0.tar.gz
Insert the hash into the generated version line, for example version('1.0.0', sha256='<HASH>').
- Install the package
spack install dummy-software && module load Core/dummy-software && hello-world