liminix-fork/pkgs/liminix-tools/services/builder.sh
2023-03-04 23:08:25 +00:00

20 lines
680 B
Bash

source $stdenv/setup
mkdir -p $out/${name}
echo $serviceType > $out/${name}/type
mkdir -p $out/${name}/dependencies.d
echo $buildInputs > $out/buildInputs
test -n "$dependencies" && for d in $dependencies; do
touch $out/${name}/dependencies.d/$d
done
test -n "$contents" && for d in $contents; do
mkdir -p $out/${name}/contents.d
touch $out/${name}/contents.d/$d
done
for i in run notification-fd up down consumer-for producer-for pipeline-name ; do
test -n "$(printenv $i)" && (echo "$(printenv $i)" > $out/${name}/$i)
done
( cd $out && ln -s /run/service-state/${name} ./.outputs )
for i in $out/${name}/{down,up,run} ; do test -f $i && chmod +x $i; done
true