spacefrogg-overlay/x-plane/airport-env-hd.nix

46 lines
1.8 KiB
Nix

{ stdenv, lib, mkXPlaneAddon
, europeanNumbers ? false }:
mkXPlaneAddon {
pname = "airport-env-hd";
version = "2.13";
fname = "Airport_Environment_HD_2.13.zip";
sha256 = "1m4wdr2ld0brynaf422hjvqcyq4bryanni12bg96j0m02szpmvs6";
forumlink = "https://forums.x-plane.org/index.php?/files/file/35172-airport-environment-hd/";
buildCommand = ''
mkdir -p $out/Resources/bitmaps/runways $out/"Custom Scenery"
unzip $src
cp -r "Part 1 "*/* $out/Resources/bitmaps/runways
cp -r "Part 2"*/* "$out/Custom Scenery"
'' + (lib.optionalString europeanNumbers ''
cp -r "Part 1.5"*/* $out/Resources/bitmaps/runways
'');
passthru = {
build = ''
ln -s $ADDONPATH $out/xplane-extra/AirportEnvHD
'';
prepare = ''
for f in asphalt concrete goodgrass rway_blaspad.dds rway_shoulders.dds skids.png taxi.dds taxi_LIT.dds; do
mv "$XPLANEPATH/Resources/bitmaps/runways/$f" "$XPLANEPATH/Resources/bitmaps/runways/''${f}.orig"
ln -s /xplane-extra/AirportEnvHD/Resources/bitmaps/runways/$f "$XPLANEPATH/Resources/bitmaps/runways"
done
ln -s "/xplane-extra/AirportEnvHD/Custom Scenery/Airport Environment HD" "$XPLANEPATH/Custom Scenery/Airport Environment HD"
'';
revert = ''
if [ -L "$XPLANEPATH/Custom Scenery//Airport Environment HD" ]; then
rm "$XPLANEPATH/Custom Scenery//Airport Environment HD"
else
false
fi
for f in asphalt concrete goodgrass rway_blaspad.dds rway_shoulders.dds skids.png taxi.dds taxi_LIT.dds; do
if [ -e "$XPLANEPATH/Resources/bitmaps/runways/''${f}.orig" ]; then
rm "$XPLANEPATH/Resources/bitmaps/runways/''${f}"
mv "$XPLANEPATH/Resources/bitmaps/runways/''${f}.orig" "$XPLANEPATH/Resources/bitmaps/runways/$f"
fi
done
'';
};
}