outboard.nix (622B)
1 { 2 liminix, 3 lib, 4 json-to-fstree, 5 serviceFns, 6 }: 7 { 8 name, 9 url, 10 interval, 11 username, 12 password, 13 }: 14 let 15 inherit (liminix.services) oneshot longrun; 16 inherit (lib) optionalString; 17 in 18 longrun { 19 inherit name; 20 buildInputs = [ json-to-fstree ]; 21 run = '' 22 ${optionalString (username != null) '' 23 export NETRC=$(mkstate ${name})/netrc 24 (echo default ; echo login ${username} ; echo password ${password} ) > $NETRC 25 ''} 26 ( in_outputs ${name} 27 while : ; do 28 ${json-to-fstree}/bin/json-to-fstree ${url} . 29 sleep ${builtins.toString (interval * 60)} 30 done 31 ) 32 ''; 33 }