1 (define-module (gnu services science)
2 #:export (<rshiny-configuration>
5 rshiny-configuration-package
6 rshiny-configuration-binary
7 rshiny-shepherd-service
13 (use-service-modules shepherd)
14 (use-package-modules cran)
16 (define-record-type* <rshiny-configuration>
18 make-rshiny-configuration
20 (package rshiny-configuration-package ; package
22 (binary rshiny-configuration-binary ; string
25 (define rshiny-shepherd-service
27 (($ <rshiny-configuration> package binary)
30 (documentation (string-append "R-Shiny service for " binary))
31 (provision (list (symbol-append 'rshiny- (string->symbol
32 (string-take binary 9)))))
33 (requirement '(networking))
37 #$(string-append "/run/current-system/profile/bin/" binary))
38 ;#:log-file #$(string-append "/var/log/" binary ".log") ; kills shepherd
39 #:environment-variables
40 (list "R_LIBS_USER=/run/current-system/profile/site-library/")))
41 (stop #~(make-kill-destructor)))))))
43 (define rshiny-service-type
48 (service-extension shepherd-root-service-type
49 rshiny-shepherd-service)
50 (service-extension profile-service-type
51 ;; We want the package installed so that it
52 ;; pulls in the propagated inputs as well.
55 (rshiny-configuration-package config))))))
57 "Run an R-Shiny webapp as a Guix Service.")))