spacefrogg-overlay/x-plane/simHeaven/x-world-vegetation.nix

41 lines
1.0 KiB
Nix

{ stdenv
, lib
, mkXPlaneAddon
}:
mkXPlaneAddon {
pname = "x-world-vegetation";
version = "1.0";
fname = "simHeaven_X-World_Vegetation_Library.7z";
sha256 = "sha256-NxiLAmnz2YHrc/MyGfExEzCdl/yvURNSWMGcIQ8Csnw=";
forumlink = "https://simheaven.com/simdownloads/x-world-vegetation-library/";
buildCommand = ''
mkdir -p "$out/Custom Scenery/"
7z x $src
cp -r simHeaven* "$out/Custom Scenery"
'';
passthru = let
dirName="simHeaven_X-World_Vegetation_Library";
addonPath = "$XPLANEPATH/Custom Scenery/${dirName}";
in {
build = ''
ln -s $ADDONPATH $out/xplane-extra/x-world-vegetation
'';
prepare = ''
mkdir -p "${addonPath}"
for f in "/xplane-extra/x-world-vegetation/Custom Scenery/${dirName}/"* ; do
ln -s "$f" "${addonPath}/$(basename "$f")"
done
ln -s "$XPLANEPATH/Resources/default scenery/1200 forests" "${addonPath}/1200 forests"
'';
revert = ''
if [ -d "${addonPath}" ]; then
rm -r "${addonPath}"
else
false
fi
'';
};
}