Skip to content

Instantly share code, notes, and snippets.

@muradm
Created March 1, 2021 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save muradm/8cf0192dd28154d881c5c7ae657f2531 to your computer and use it in GitHub Desktop.
Save muradm/8cf0192dd28154d881c5c7ae657f2531 to your computer and use it in GitHub Desktop.
shepherd starter script
#!/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