2022-04-16 07:13:33 +02:00
|
|
|
(define-module (oni gexp)
|
|
|
|
#:use-module (guix gexp)
|
|
|
|
|
|
|
|
#:export (mixed-executable-file))
|
|
|
|
|
|
|
|
(define* (mixed-executable-file name #:key guile #:rest text)
|
|
|
|
"Return an object representing store file NAME containing TEXT and having the
|
|
|
|
executable bit set. TEXT is a sequence of strings and file-like objects, as in:
|
|
|
|
|
|
|
|
(mixed-executable-file \"profile\"
|
|
|
|
\"export PATH=\" coreutils \"/bin:\" grep \"/bin\")"
|
|
|
|
(define build
|
|
|
|
(let ((text (if guile (drop text 2) text)))
|
|
|
|
(gexp (call-with-output-file (ungexp output "out")
|
2023-06-21 08:06:25 +02:00
|
|
|
(λ (port)
|
2022-04-16 07:13:33 +02:00
|
|
|
(set-port-encoding! port "UTF-8")
|
|
|
|
(display (string-append (ungexp-splicing text)) port)
|
|
|
|
(chmod port #o555))))))
|
|
|
|
|
|
|
|
(computed-file name build #:guile guile))
|