Created
March 1, 2021 17:41
-
-
Save muradm/8cf0192dd28154d881c5c7ae657f2531 to your computer and use it in GitHub Desktop.
shepherd starter script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env -S guix repl -- | |
!# | |
;; dynamic version of /gnu/store/....-shepherd-.../bin/shepherd | |
;; here we want to run shepherd with guix guile, in order | |
;; to be able to use (use-modules (guix ...)) in our scripts | |
;; | |
;; Why: currently guix runs with guile-3.0.5, while stock | |
;; shepherd is provided with guile-3.0.2. When importing modules | |
;; guix, it gives tones of "bytecode incompatible" warnings | |
;; and works very very slow | |
(use-modules (ice-9 popen) (ice-9 rdelim) (ice-9 regex) | |
((guix packages) #:select (package-file)) | |
((guix store) #:select (open-connection close-connection run-with-store)) | |
(gnu packages admin)) | |
(define shepherd-dir | |
(let* | |
((s (open-connection)) | |
(p (run-with-store s (package-file shepherd))) | |
(c (close-connection s))) | |
p)) | |
(define shepherd-guile-site (string-append shepherd-dir "/share/guile/site/3.0")) | |
(set! %load-path (append (list shepherd-guile-site) %load-path)) | |
(apply (@ (shepherd) main) (cdr (command-line))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment