(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)
                                        ;; TODO: could be that "herd
                                        ;; restart networking" fails
                                        ;; if this gets run too early?
                                        (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)))))

Generated by Ricardo Wurmus using scpaste at Tue Jan 30 11:57:15 2024. CET. (original)