diff options
Diffstat (limited to 'oni/gexp.scm')
-rw-r--r-- | oni/gexp.scm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/oni/gexp.scm b/oni/gexp.scm new file mode 100644 index 0000000..388c7a2 --- /dev/null +++ b/oni/gexp.scm @@ -0,0 +1,20 @@ +(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") + (lambda (port) + (set-port-encoding! port "UTF-8") + (display (string-append (ungexp-splicing text)) port) + (chmod port #o555)))))) + + (computed-file name build #:guile guile)) |