@@ -1,14 +1,14 @@
1−{ stdenv, fetchurl, perl, pathsFromGraph, fetchFromGitHub, musl }:
1+{ stdenv, fetchurl, perl, pathsFromGraph, fetchFromGitHub, musl, coreutils, bash }:
22
33let
4− AppRun = stdenv.mkDerivation {
4+ AppRun = targets: stdenv.mkDerivation {
55 name = "AppRun";
66
77 phases = [ "buildPhase" "installPhase" "fixupPhase" ];
88
99 buildPhase = ''
1010 CC="${musl}/bin/musl-gcc -O2 -Wall -Wno-deprecated-declarations -Wno-unused-result -static"
11− $CC ${./AppRun.c} -o AppRun
11+ $CC ${./AppRun.c} -o AppRun -DENV_PATH='"${stdenv.lib.makeBinPath targets}"'
1212 '';
1313
1414 installPhase = ''
@@ -19,9 +19,10 @@ let
1919
2020in
2121
22− { target, name }: stdenv.mkDerivation {
22+ { target, name, extraTargets ? [ coreutils bash ] }: let targets = ([ target ] ++ extraTargets);
23+ in stdenv.mkDerivation {
2324 name = "${name}.AppDir";
24− exportReferencesGraph = map (x: [("closure-" + baseNameOf x) x]) [ target ];
25+ exportReferencesGraph = map (x: [("closure-" + baseNameOf x) x]) targets;
2526 nativeBuildInputs = [ perl ];
2627 buildCommand = ''
2728 # TODO use symlinks to shrink output size
@@ -75,6 +76,6 @@ in
7576 fi
7677 fi
7778
78− cp ${AppRun}/bin/AppRun AppRun
79+ cp ${AppRun targets}/bin/AppRun AppRun
7980 '';
8081 }