mission-planner: reduce closure size

The release zip file doesn't contain a top level directory. The previous
solution of `sourceRoot = "."` followed by an `installPhase` of `mv *
$out/...` does install correctly. However, this grabs detritus from the
Nix build sandbox root, in particular `env-vars`, resulting in an
accidental run-time dependency on many build-time inputs.

Fix by instead using a custom `unpackPhase` to change into an empty
directory, then extracting the release and proceeding with the
installation from there, so that only files from the release are
installed. This reduces closure size by ~425M.

Tested that Mission Planner opens and connects to a drone.
This commit is contained in:
Thomas Watson 2025-03-27 13:45:21 -05:00
parent e974455152
commit 438d311460

View File

@ -34,7 +34,17 @@ stdenv.mkDerivation rec {
mono
unzip
];
sourceRoot = ".";
# zip has no outer directory, so make one and unpack there
unpackPhase = ''
runHook preUnpack
mkdir -p source
cd source
unzip -q $src
runHook postUnpack
'';
AOT_FILES = [
"MissionPlanner.exe"