spacefrogg-overlay/x-plane/sam-suite/sam-basic.nix

39 lines
1.0 KiB
Nix
Raw Normal View History

2022-06-08 14:01:14 +02:00
{ stdenv, lib, mkXPlaneAddon, xPlaneEnv }:
2020-10-18 14:34:40 +02:00
let
2022-06-08 14:01:14 +02:00
inherit (lib) findFirst optionalString;
2020-10-18 14:34:40 +02:00
inherit (builtins) isDerivation;
globalTrees = findFirst (k: k.pname == "sam-global-trees") false xPlaneEnv.addons;
in mkXPlaneAddon rec {
pname = "sam-basic";
version = "2.0.5";
fname = "SAM_${version}.7z";
sha256 = "1f97r4g5cvhphkr2widcd9w0p5z66lahbjk3cm6rs6y0rvyz66pf";
forumlink = "https://sam.stairport-sceneries.com/${fname}";
buildCommand = ''
mkdir -p $out
7z x -o$out $src
ln -s ${globalTrees} $out/SAM/lib/SAM_GlobalTrees
'';
passthru = {
build = ''
ln -s $ADDONPATH $out/xplane-extra/SAM
'';
# Must be copied because it writes logs
prepare = ''
cp -r --no-preserve=mode -t "$XPLANEPATH/Resources/plugins" /xplane-extra/SAM/SAM
touch "$XPLANEPATH/Resources/plugins/SAM/.prepared"
'';
revert = ''
if [ -f "$XPLANEPATH/Resources/plugins/SAM/.prepared" ]; then
rm -rf "$XPLANEPATH/Resources/plugins/SAM"
else
false
fi
'';
};
}