x-plane updates

master
Michael Raitza 2022-06-08 14:01:14 +02:00
parent 0c87b9bcbb
commit 04b4442abb
9 changed files with 107 additions and 21 deletions

View File

@ -9,6 +9,7 @@ let
xPlaneEnv = callPackage ./x-plane { xplanePathStr = "/home/games/xplane"; xPlaneEnv = callPackage ./x-plane { xplanePathStr = "/home/games/xplane";
addons = [ headshake beautifulRoads samBasic samGlobalTrees flyWithLua vividSky airportEnvHD betterLights extendedNightLights toLissA321 ]; }; addons = [ headshake beautifulRoads samBasic samGlobalTrees flyWithLua vividSky airportEnvHD betterLights extendedNightLights toLissA321 ]; };
xPlaneSDK = callPackage ./x-plane/sdk.nix {}; xPlaneSDK = callPackage ./x-plane/sdk.nix {};
ortho4xp = callPackage ./ortho4xp.nix {};
airportEnvHD = callPackage ./x-plane/airport-env-hd.nix {}; airportEnvHD = callPackage ./x-plane/airport-env-hd.nix {};
beautifulRoads = callPackage ./x-plane/beautiful-roads.nix {}; beautifulRoads = callPackage ./x-plane/beautiful-roads.nix {};

View File

@ -2,12 +2,11 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1625176478, "lastModified": 1649541905,
"narHash": "sha256-s1RTYNKw7ySyqrZjns9Cq+Nnjpp75ePgL06pgcbIpoA=", "narHash": "sha256-e8uePwD302weU4saoLg5uhb0yI5ZbHl/L49ncKejh5o=",
"owner": "NixOS", "path": "/nix/store/bzydgk2vb1lh6zkf1x77r4l0r0r99kd6-source",
"repo": "nixpkgs", "rev": "db81927829becddb57db2b3b3e34301ed4af8d0a",
"rev": "21b696caf392ad6fa513caf3327d0aa0430ffb72", "type": "path"
"type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "id": "nixpkgs",

View File

@ -9,6 +9,6 @@
outputs = { nixpkgs, ... }: rec { outputs = { nixpkgs, ... }: rec {
overlay = import ./default.nix; overlay = import ./default.nix;
legacyPackages."x86_64-linux" = import nixpkgs { system = "x86_64-linux"; overlays = [ overlay ]; }; legacyPackages."x86_64-linux" = import nixpkgs { system = "x86_64-linux"; overlays = [ overlay ]; config.allowUnfree = true; };
}; };
} }

18
ortho4xp.nix Normal file
View File

@ -0,0 +1,18 @@
{ lib, fetchFromGitHub
, python3Packages, p7zip, nvidia-texture-tools, gdal, freeglut }:
python3Packages.buildPythonApplication rec {
pname = "Ortho4XP";
version = "1.3";
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = "e20f0f4d7a5cb976bfdca87add265034179c9b9f";
hash = "sha256-WUlfhRBq4j1Eno+iMWKjjmtjpmUKvXaV2/5BOP5CoOU=";
};
propagatedBuildInputs = with python3Packages; [
requests pyproj numpy gdal shapely Rtree p7zip
nvidia-texture-tools freeglut pillow-simd gdal tkinter ];
}

View File

@ -1,4 +1,4 @@
{ stdenv, mkXPlaneAddon { stdenv, lib, mkXPlaneAddon
, europeanNumbers ? false }: , europeanNumbers ? false }:
mkXPlaneAddon { mkXPlaneAddon {
@ -13,7 +13,7 @@ mkXPlaneAddon {
unzip $src unzip $src
cp -r "Part 1 "*/* $out/Resources/bitmaps/runways cp -r "Part 1 "*/* $out/Resources/bitmaps/runways
cp -r "Part 2"*/* "$out/Custom Scenery" cp -r "Part 2"*/* "$out/Custom Scenery"
'' + (stdenv.lib.optionalString europeanNumbers '' '' + (lib.optionalString europeanNumbers ''
cp -r "Part 1.5"*/* $out/Resources/bitmaps/runways cp -r "Part 1.5"*/* $out/Resources/bitmaps/runways
''); '');

View File

@ -18,20 +18,36 @@
# attribute set to null. # attribute set to null.
{ stdenv, writeScript, buildFHSUserEnv { stdenv, writeScript, buildFHSUserEnv, lib
, xplanePathStr , xplanePathStr, unzip
, addons ? []}: , addons ? []}:
let let
inherit (stdenv.lib) concatMapStrings optionalString unique; inherit (lib) concatMapStrings optionalString unique;
runScript = writeScript "x-plane-script" '' runScript = writeScript "x-plane-script" ''
#!${stdenv.shell} #!${stdenv.shell}
usage() {
cat <<EOF >&2
x-plane-env OPT
X-Plane run X-Plane (default)
Airfoil run Airfoil Maker
Plane run Plane Maker
Installer run Installer
SHELL run bash inside FHS environment
prepare prepare all currently activated addons
revert [ADDON]... remove modifications from named addons
navdata FILE [OLDCYCLE] update navigation DB
/abs/path [ARG]... run /abs/path inside FHS environment
rel/path [ARG]... run $XPLANEPATH/rel/path inside FHS environment
EOF
}
sys=${stdenv.targetPlatform.system} sys=${stdenv.targetPlatform.system}
sys=''${sys%-linux} sys=''${sys%-linux}
bin=$1 bin=$1
: ''${XPLANEPATH:=${xplanePathStr}} : ''${XPLANEPATH:=${xplanePathStr}}
export XPLANEPATH export XPLANEPATH
case "$bin" in case "$bin" in
--help) usage; exit ;;
X-Plane) exec "''${XPLANEPATH}/X-Plane-$sys" ;; X-Plane) exec "''${XPLANEPATH}/X-Plane-$sys" ;;
Airfoil*) exec "''${XPLANEPATH}/Airfoil Maker-$sys" ;; Airfoil*) exec "''${XPLANEPATH}/Airfoil Maker-$sys" ;;
Plane*) exec "''${XPLANEPATH}/Plane Maker-$sys" ;; Plane*) exec "''${XPLANEPATH}/Plane Maker-$sys" ;;
@ -40,6 +56,7 @@ let
SHELL) exec "bash" ;; SHELL) exec "bash" ;;
prepare) exec ${prepareScript} ;; prepare) exec ${prepareScript} ;;
revert) shift; exec ${revertScript} "$@" ;; revert) shift; exec ${revertScript} "$@" ;;
navdata) shift; exec ${navdbScript} "$@" ;;
/*) exec "$@" ;; /*) exec "$@" ;;
*) shift; exec "''${XPLANEPATH}/$bin" "$@" ;; *) shift; exec "''${XPLANEPATH}/$bin" "$@" ;;
esac esac
@ -68,7 +85,7 @@ let
${addon.passthru.prepare} ${addon.passthru.prepare}
'' + (if (addon.passthru ? revert) then '' '' + (if (addon.passthru ? revert) then ''
cat <<'EOF' >"$XPLANEPATH/.addons/revert-${addon.pname}" cat <<'EOF' >"$XPLANEPATH/.addons/revert-${addon.pname}"
#!${stdenv.shell} #!/usr/bin/env bash
set -e set -e
${addon.passthru.revert} ${addon.passthru.revert}
rm $0 rm $0
@ -98,6 +115,57 @@ let
fi fi
''; '';
navdbScript = writeScript "update-navdata" ''
#!/usr/bin/env bash
set -euo pipefail
: ''${XPLANEPATH:=${xplanePathStr}}
[ $# -ne 0 ] || {
printf "usage: update-navdata FILE [OLDCYCLE]\n\nFILE xplane11_native_CYCL.zip file\nOLDCYCLE old cycle ID for backup (default auto detect)\n" >&2
exit 1; }
if [ $# -ge 2 ]; then
oldcycle=$2
elif [ -e "$XPLANEPATH/Custom Data/cycle_info.txt" ]; then
oldcycle=$(head -n1 "$XPLANEPATH/Custom Data/cycle_info.txt" | sed -E -n -e "s/^AIRAC cycle[ :]+([0-9]+)\r$/\1/p")
[ -n "$oldcycle" ] || { printf "Unable to determine old AIRAC cycle\n" >&2; exit 1; }
fi
f=$1
[ -e "$f" ] || { printf "No such file or directory\n" >&2; exit 1; }
cycle=''${1##*_}
cycle=''${cycle%.zip}
newpath="$XPLANEPATH/Custom Data AIRAC$cycle"
if [ ! -h "$XPLANEPATH/Custom Data" ]; then
mv "$XPLANEPATH/Custom Data" "$XPLANEPATH/Custom Data AIRAC$oldcycle"
fi
if [ -d "$newpath" ]; then
rm -rf "$newpath"
fi
${lib.getBin unzip}/bin/unzip -d "$newpath" "$f"
cat <<EOF >"$newpath/Readme.txt"
Place newer navigational data for the global database in THIS folder.
If you want to replace any of X-Plane's
earth_nav.dat
earth_awy.dat
earth_fix.dat
CIFP/*
with newer data, then place them HERE IN THIS FOLDER to avoid conflicts with the X-Plane updater.
Note that this database is also used by X-Planes GPS and previously needed files in other subfolders are now ignored.
Also, you can place the FAACIFP18 file here, which you can get from the FAA website: https://www.faa.gov/air_traffic/flight_info/aeronav/digital_products/cifp/
If the file FAACIFP18 is found in this folder, X-Plane will load instrument flight procedures from this file.
EOF
rm "$XPLANEPATH/Custom Data"
ln -sf "$newpath" "$XPLANEPATH/Custom Data"
'';
in buildFHSUserEnv rec { in buildFHSUserEnv rec {
name = "x-plane-env"; name = "x-plane-env";
passthru = { inherit addons; }; passthru = { inherit addons; };

View File

@ -1,4 +1,4 @@
{ stdenv, cmake, fetchurl, fetchFromGitHub, unzip, xPlaneSDK }: { stdenv, lib, cmake, fetchurl, fetchFromGitHub, unzip, xPlaneSDK }:
let let
in stdenv.mkDerivation rec { in stdenv.mkDerivation rec {
pname = "headshake"; pname = "headshake";
@ -38,7 +38,7 @@ in stdenv.mkDerivation rec {
meta = { meta = {
description = "Headshake plugin for X-Plane 11"; description = "Headshake plugin for X-Plane 11";
license = stdenv.lib.licenses.gpl3; license = lib.licenses.gpl3;
maintainer = [ stdenv.lib.maintainers.spacefrogg ]; maintainer = [ lib.maintainers.spacefrogg ];
}; };
} }

View File

@ -1,4 +1,4 @@
{ stdenv, requireFile, openssl, qt5, p7zip, unzip }: { stdenv, lib, requireFile, openssl, qt5, p7zip, unzip }:
let let
fname = "LINUX_-_SAM_Suite.zip"; fname = "LINUX_-_SAM_Suite.zip";
@ -22,7 +22,7 @@ in qt5.mkDerivation {
nativeBuildInputs = [ unzip ]; nativeBuildInputs = [ unzip ];
phases = [ "buildPhase" "patchPhase" "configurePhase" "fixupPhase" ]; phases = [ "buildPhase" "patchPhase" "configurePhase" "fixupPhase" ];
nativeBuildInptus = [ unzip ]; nativeBuildInptus = [ unzip ];
libPath = stdenv.lib.makeLibraryPath [ qt5.qtbase p7zip openssl stdenv.cc.cc ]; libPath = lib.makeLibraryPath [ qt5.qtbase p7zip openssl stdenv.cc.cc ];
buildPhase = '' buildPhase = ''
unzip $src others/samsuite.zip unzip $src others/samsuite.zip
unzip others/samsuite.zip unzip others/samsuite.zip
@ -31,6 +31,6 @@ in qt5.mkDerivation {
cp usr/bin/SamSuite $out/bin cp usr/bin/SamSuite $out/bin
cp -r usr/share $out cp -r usr/share $out
patchelf --set-rpath "$libPath" --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $out/bin/SamSuite patchelf --set-rpath "$libPath" --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) $out/bin/SamSuite
wrapProgram $out/bin/SamSuite --prefix PATH : ${stdenv.lib.getBin p7zip}/bin wrapProgram $out/bin/SamSuite --prefix PATH : ${lib.getBin p7zip}/bin
''; '';
} }

View File

@ -1,7 +1,7 @@
{ stdenv, mkXPlaneAddon, xPlaneEnv }: { stdenv, lib, mkXPlaneAddon, xPlaneEnv }:
let let
inherit (stdenv.lib) findFirst optionalString; inherit (lib) findFirst optionalString;
inherit (builtins) isDerivation; inherit (builtins) isDerivation;
globalTrees = findFirst (k: k.pname == "sam-global-trees") false xPlaneEnv.addons; globalTrees = findFirst (k: k.pname == "sam-global-trees") false xPlaneEnv.addons;