tang.nix (681B)
1 { 2 liminix, 3 lib, 4 json-to-fstree, 5 serviceFns, 6 tangc, 7 }: 8 { 9 name, 10 path, 11 interval, 12 }: 13 let 14 inherit (liminix.services) longrun; 15 inherit (lib) optionalString; 16 in 17 longrun { 18 inherit name; 19 buildInputs = [ json-to-fstree ]; 20 notification-fd = 10; 21 run = '' 22 set -e 23 statedir=/run/${name} 24 mkdir -p -m 0700 $statedir 25 ( in_outputs ${name} 26 while : ; do 27 ${tangc}/bin/tangc decrypt < ${path} > $statedir/.input.json 28 mv $statedir/.input.json $statedir/input.json 29 ${json-to-fstree}/bin/json-to-fstree file://$statedir/input.json . 30 echo ready >&10 31 sleep ${builtins.toString (interval * 60)} 32 done 33 ) 34 ''; 35 }