1
0
forked from dan/liminix
liminix/pkgs/service-fns/default.nix
Daniel Barlow 3df1ec76ff cleanup whitespace and commas
* [] is now [ ]
* {} is now { }
* commas in arglists go at end of line not beginning

In short, I ran the whole thing through nixfmt-rfc-style but only
accepted about 30% of its changes. I might grow accustomed to more
of it over time
2024-06-30 17:16:28 +01:00

33 lines
670 B
Nix

{ writeText }:
writeText "service-fns.sh" ''
output() { cat $1/.outputs/$2; }
output_word() {
set -f
local i=1
for var in $(cat $1/.outputs/$2); do
if test "$i" == "$3" ; then
echo $var
fi
i=$(expr $i + 1)
done
set +f
}
output_path() { echo $(realpath $1/.outputs)/$2; }
SERVICE_OUTPUTS=/run/services/outputs
SERVICE_STATE=/run/services/state
mkoutputs() {
d=$SERVICE_OUTPUTS/$1
mkdir -m 2751 -p $d && chown root:system $d
echo $d
}
mkstate() {
d=$SERVICE_STATE/$1
mkdir -m 2751 -p $d && chown root:system $d
echo $d
}
in_outputs() {
cd `mkoutputs $1` && umask 0027
}
''