2020-08-04 18:38:33 +02:00
|
|
|
{
|
|
|
|
stdenv
|
|
|
|
}:
|
|
|
|
|
2020-08-12 14:00:04 +02:00
|
|
|
apps: # Each app must be unique
|
2020-08-10 15:27:46 +02:00
|
|
|
|
2020-08-04 18:38:33 +02:00
|
|
|
stdenv.mkDerivation {
|
2020-08-10 15:27:46 +02:00
|
|
|
name = "launcher";
|
2020-08-04 18:38:33 +02:00
|
|
|
preferLocalBuild = true;
|
|
|
|
|
2020-08-10 18:25:53 +02:00
|
|
|
buildInputs = [] ++ apps;
|
|
|
|
apps = apps;
|
2020-08-04 18:38:33 +02:00
|
|
|
phases = [ "installPhase" ];
|
2020-08-10 18:25:53 +02:00
|
|
|
dontPatchShebangs = true;
|
2020-08-04 18:38:33 +02:00
|
|
|
|
|
|
|
installPhase = ''
|
2020-08-10 18:25:53 +02:00
|
|
|
mkdir -p $out/apps
|
|
|
|
for j in $apps; do
|
2020-08-12 14:00:04 +02: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-04 18:38:33 +02:00
|
|
|
done
|
|
|
|
|
|
|
|
mkdir -p $out/bin
|
2020-08-10 15:27:46 +02:00
|
|
|
cat > $out/bin/run <<EOF
|
2020-08-10 14:13:28 +02:00
|
|
|
#!/bin/sh
|
2020-08-04 18:38:33 +02:00
|
|
|
|
2020-08-10 18:25:53 +02:00
|
|
|
for j in $out/apps/*; do
|
|
|
|
\$j/bin/run
|
2020-08-04 18:38:33 +02:00
|
|
|
done
|
|
|
|
EOF
|
|
|
|
|
2020-08-10 15:27:46 +02:00
|
|
|
chmod +x $out/bin/run
|
2020-08-04 18:38:33 +02:00
|
|
|
'';
|
|
|
|
}
|