liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

tang.nix (669B)


      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 in
     16 longrun {
     17   inherit name;
     18   buildInputs = [ json-to-fstree ];
     19   notification-fd = 10;
     20   run = ''
     21     set -e
     22     statedir=/run/${name}
     23     mkdir -p -m 0700 $statedir
     24     ( in_outputs ${name}
     25       while : ; do
     26         ${tangc}/bin/tangc decrypt < ${path} > $statedir/.input.json
     27         mv $statedir/.input.json $statedir/input.json
     28         ${json-to-fstree}/bin/json-to-fstree file://$statedir/input.json  ${placeholder "out"}
     29         echo ready >&10
     30         sleep ${builtins.toString (interval * 60)}
     31       done
     32     )
     33   '';
     34 }