(simple-service 'wait-for-ip shepherd-root-service-type
(list (shepherd-service
(provision '(wait-for-ip))
(documentation "Start rstudio when network comes up")
(requirement '(user-processes))
(one-shot? #true)
(start '(make-forkexec-constructor
'("/bin/sh" "-c"
"\
herd restart networking;\
tail -f --retry /var/log/messages | grep -Em 1 \"dhclient: bound to 10.0.0.\" && \
herd enable rstudio-server && herd start rstudio-server")
#:environment-variables
(list "PATH=/run/current-system/profile/bin:/run/current-system/profile/sbin")))
(stop '(make-kill-destructor)))))