spacefrogg-overlay/x-plane/vivid-sky.nix

49 lines
1.9 KiB
Nix

{ stdenv, mkXPlaneAddon }:
mkXPlaneAddon rec {
pname = "vivid-sky";
version = "1.1";
fname = "Vivid_Sky.zip";
sha256 = "17x66qsd9ycw1bcp5avh592yqcrlgwzkcx2ly4cqi10504gs1rdx";
forumlink = "https://forums.x-plane.org/index.php?/files/file/48315-vivid-sky/";
buildCommand = ''
mkdir -p $out
unzip $src '1. Vivid Sky/Resources/*' '2. Vivid Water (Optional)/*'
mv '1. Vivid Sky/Resources' $out
cp -r '2. Vivid Water (Optional)/Resources' $out
'';
passthru = {
build = ''
ln -s $ADDONPATH $out/xplane-extra/vivid-sky
'';
prepare = ''
mv "$XPLANEPATH/Resources/bitmaps/skycolors" "$XPLANEPATH/Resources/bitmaps/skycolors.orig"
mv "$XPLANEPATH/Resources/bitmaps/world/clouds" "$XPLANEPATH/Resources/bitmaps/world/clouds.orig"
ln -s /xplane-extra/vivid-sky/Resources/bitmaps/skycolors "$XPLANEPATH/Resources/bitmaps/skycolors"
ln -s /xplane-extra/vivid-sky/Resources/bitmaps/world/clouds "$XPLANEPATH/Resources/bitmaps/world/clouds"
mkdir -p "$XPLANEPATH/Resources/plugins/FlyWithLua/Scripts"
ln -sf /xplane-extra/vivid-sky/Resources/plugins/FlyWithLua/Scripts/vivid_sky.lua "$XPLANEPATH/Resources/plugins/FlyWithLua/Scripts/vivid_sky.lua"
ln -sf /xplane-extra/vivid-sky/Resources/plugins/FlyWithLua/Scripts/vivid_water.lua "$XPLANEPATH/Resources/plugins/FlyWithLua/Scripts/vivid_water.lua"
'';
revert = ''
for f in "$XPLANEPATH/Resources/bitmaps/skycolors" "$XPLANEPATH/Resources/bitmaps/world/clouds" ; do
if [ -L "$f" ]; then
rm "$f"
mv "''${f}.orig" "$f"
else
false
fi
done
for f in "$XPLANEPATH/Resources/plugins/FlyWithLua/Scripts/vivid_sky.lua" "$XPLANEPATH/Resources/plugins/FlyWithLua/Scripts/vivid_water.lua" ; do
if [ -L "$f" ]; then
rm "$f"
else
false
fi
done
'';
};
}