fix: Use dynamic path for release directory in postInstall

Instead of hardcoding the version in the path, find the release
directory dynamically. This fixes the 'undefined variable version'
error during Docker image build.
This commit is contained in:
Graham McIntire 2026-02-07 12:42:46 -06:00
parent a980afa947
commit d8a0a9ca4d
No known key found for this signature in database

View file

@ -79,15 +79,20 @@ beamPackages.mixRelease {
# Install MIB files to the release
postInstall = ''
# Copy MIB files directory
if [ -d "$src/priv/mibs" ]; then
mkdir -p $out/lib/towerops-${version}/priv/mibs
cp -r $src/priv/mibs/* $out/lib/towerops-${version}/priv/mibs/
fi
# Find the release directory (mixRelease creates lib/<name>-<version>)
RELEASE_DIR=$(find $out/lib -maxdepth 1 -type d -name "towerops-*" | head -1)
# Ensure NIF is in the release
mkdir -p $out/lib/towerops-${version}/priv
cp ${towerops-nif}/lib/towerops_nif.so $out/lib/towerops-${version}/priv/
if [ -n "$RELEASE_DIR" ]; then
# Copy MIB files directory
if [ -d "$src/priv/mibs" ]; then
mkdir -p $RELEASE_DIR/priv/mibs
cp -r $src/priv/mibs/* $RELEASE_DIR/priv/mibs/
fi
# Ensure NIF is in the release
mkdir -p $RELEASE_DIR/priv
cp ${towerops-nif}/lib/towerops_nif.so $RELEASE_DIR/priv/
fi
'';
meta = {