2020-08-05 00:38:33 +08:00
|
|
|
{
|
|
|
|
stdenv
|
|
|
|
}:
|
|
|
|
|
2020-08-12 20:00:04 +08:00
|
|
|
apps: # Each app must be unique
|
2020-08-10 21:27:46 +08:00
|
|
|
|
2020-08-05 00:38:33 +08:00
|
|
|
stdenv.mkDerivation {
|
2020-08-10 21:27:46 +08:00
|
|
|
name = "launcher";
|
2020-08-05 00:38:33 +08:00
|
|
|
preferLocalBuild = true;
|
|
|
|
|
2020-08-11 00:25:53 +08:00
|
|
|
buildInputs = [] ++ apps;
|
|
|
|
apps = apps;
|
2020-08-05 00:38:33 +08:00
|
|
|
phases = [ "installPhase" ];
|
2020-08-11 00:25:53 +08:00
|
|
|
dontPatchShebangs = true;
|
2020-08-05 00:38:33 +08:00
|
|
|
|
|
|
|
installPhase = ''
|
2020-08-11 00:25:53 +08:00
|
|
|
mkdir -p $out/apps
|
|
|
|
for j in $apps; do
|
2020-08-12 20:00:04 +08:00
|
|
|
target=$out/apps/$(basename $j)
|
|
|
|
if [ -e $target ]; then
|
|
|
|
echo "Duplicated app: $j"
|
|
|
|
echo
|
|
|
|
echo "Provided apps: "
|
|
|
|
printf "%s\n" $apps
|
|
|
|
echo
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
ln -s $j $target
|
2020-08-05 00:38:33 +08:00
|
|
|
done
|
|
|
|
|
|
|
|
mkdir -p $out/bin
|
2020-08-10 21:27:46 +08:00
|
|
|
cat > $out/bin/run <<EOF
|
2020-08-10 20:13:28 +08:00
|
|
|
#!/bin/sh
|
2020-08-05 00:38:33 +08:00
|
|
|
|
2020-08-11 00:25:53 +08:00
|
|
|
for j in $out/apps/*; do
|
|
|
|
\$j/bin/run
|
2020-08-05 00:38:33 +08:00
|
|
|
done
|
|
|
|
EOF
|
|
|
|
|
2020-08-10 21:27:46 +08:00
|
|
|
chmod +x $out/bin/run
|
2020-10-01 16:48:54 +08:00
|
|
|
|
|
|
|
# Mark the launcher for upload
|
|
|
|
touch $out/.upload-to-mn
|
2020-08-05 00:38:33 +08:00
|
|
|
'';
|
|
|
|
}
|