generalise x-plane-env wrapper and init xPlane12Env

Drop unused old xplane.nix build script
master
Michael Raitza 2022-10-02 19:02:44 +02:00
parent badc12bacb
commit d353c2b134
3 changed files with 13 additions and 38 deletions

View File

@ -8,6 +8,8 @@ let
_self = {
xPlaneEnv = callPackage ./x-plane { xplanePathStr = "/home/games/xplane";
addons = [ headshake beautifulRoads samBasic samGlobalTrees flyWithLua vividSky airportEnvHD betterLights extendedNightLights toLissA321 ]; };
xPlane12Env = callPackage ./x-plane { xplanePathStr = "/home/games/xplane12"; name = "x-plane12-env";
addons = [ ]; };
xPlaneSDK = callPackage ./x-plane/sdk.nix {};
ortho4xp = callPackage ./x-plane/ortho4XPWrapper.nix { orthoPathStr = "/home/games/ortho4xp"; };

View File

@ -18,9 +18,14 @@
# attribute set to null.
{ stdenv, writeScript, buildFHSUserEnv, lib
{ stdenv
, lib
, writeScript
, buildFHSUserEnv
, xplanePathStr, unzip
, addons ? []}:
, addons ? []
, name ? "x-plane-env"
}:
let
inherit (lib) concatMapStrings optionalString unique;
@ -28,7 +33,7 @@ let
#!${stdenv.shell}
usage() {
cat <<EOF >&2
x-plane-env OPT
${name} OPT
X-Plane run X-Plane (default)
Airfoil run Airfoil Maker
Plane run Plane Maker
@ -184,12 +189,12 @@ let
'';
in buildFHSUserEnv rec {
name = "x-plane-env";
inherit name;
passthru = { inherit addons; };
# Also add GAppsWrapper environment stuff such that binaries see the GTK theme...
targetPkgs = pkgs: (with pkgs; [ unzip atk gdk-pixbuf cairo pango mesa_glu libGL openalSoft gtk2 glib dbus pulseaudio vulkan-tools vulkan-loader ] ++
targetPkgs = pkgs: (with pkgs; [ harfbuzz unzip atk gdk-pixbuf cairo pango mesa_glu libGL openalSoft gtk2 glib dbus pulseaudio vulkan-tools vulkan-loader ] ++
(with xorg; [ libX11 libXext libXrandr libXcursor libXinerama ]) ++
# For reality expansion pack
[ stdenv.cc.cc.lib curl openssl ] ++
@ -211,7 +216,7 @@ in buildFHSUserEnv rec {
extraInstallCommands = ''
mkdir -p $out/share/zsh/site-functions
ln -s ${./x-plane-env.zcomp} $out/share/zsh/site-functions/_x-plane-env
ln -s ${./x-plane-env.zcomp} $out/share/zsh/site-functions/_${name}
'';
inherit runScript;

View File

@ -1,32 +0,0 @@
{ pkgs? import <nixpkgs> {}, xplanePathStr }:
let
runScript = pkgs.writeScript "x-plane-script" ''
#!${pkgs.stdenv.shell}
sys=${pkgs.stdenv.targetPlatform.system}
sys=''${sys%-linux}
: ''${XPLANEPATH:=${xplanePathStr}}
case $1 in
X-Plane) exec "''${XPLANEPATH}/X-Plane-$sys" ;;
Airfoil*) exec "''${XPLANEPATH}/Airfoil Maker-$sys" ;;
Plane*) exec "''${XPLANEPATH}/Plane Maker-$sys" ;;
''') exec "''${XPLANEPATH}/X-Plane-$sys" ;;
SHELL) exec "bash" ;;
*) exec "''${XPLANEPATH}/$1" ;;
esac
'';
in pkgs.buildFHSUserEnv rec {
name = "x-plane-env";
# Also add GAppsWrapper environment stuff such that binaries see the GTK theme...
targetPkgs = pkgs: (with pkgs; [ unzip atk gdk_pixbuf cairo pango mesa_glu libGL openalSoft gtk2 glib dbus pulseaudio ] ++
(with xorg; [ libX11 libXext libXrandr libXcursor libXinerama ]));
extraBuildCommands = ''
chmod u+w $out/etc
mkdir $out/etc/openal
chmod u-w $out/etc
echo "drivers=pulse" > $out/etc/openal/alsoft.conf
'';
inherit runScript;
}