Centralize definition of ‘mixed-executable-file’
This commit is contained in:
parent
af4c5b3ffd
commit
b157ecf8ff
3 changed files with 22 additions and 36 deletions
20
oni/gexp.scm
Normal file
20
oni/gexp.scm
Normal file
|
@ -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))
|
|
@ -7,6 +7,7 @@
|
||||||
#:use-module (guix packages)
|
#:use-module (guix packages)
|
||||||
#:use-module (guix gexp)
|
#:use-module (guix gexp)
|
||||||
#:use-module (oni home services xsession)
|
#:use-module (oni home services xsession)
|
||||||
|
#:use-module (oni gexp)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
|
|
||||||
#:export (home-herbstluftwm-service-type
|
#:export (home-herbstluftwm-service-type
|
||||||
|
@ -47,24 +48,6 @@
|
||||||
(define (add-herbstluftwm-packages config)
|
(define (add-herbstluftwm-packages config)
|
||||||
(list (home-herbstluftwm-configuration-package config)))
|
(list (home-herbstluftwm-configuration-package config)))
|
||||||
|
|
||||||
(define* (mixed-executable-file name #:key guile #:rest text)
|
|
||||||
"Return an object representing store file NAME containing TEXT. TEXT is a
|
|
||||||
sequence of strings and file-like objects, as in:
|
|
||||||
|
|
||||||
(mixed-text-file \"profile\"
|
|
||||||
\"export PATH=\" coreutils \"/bin:\" grep \"/bin\")
|
|
||||||
|
|
||||||
This is the declarative counterpart of 'text-file*'."
|
|
||||||
(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))
|
|
||||||
|
|
||||||
(define (home-herbstluftwm-autostart-file config)
|
(define (home-herbstluftwm-autostart-file config)
|
||||||
(apply mixed-executable-file
|
(apply mixed-executable-file
|
||||||
"autostart"
|
"autostart"
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#:use-module (gnu home services utils)
|
#:use-module (gnu home services utils)
|
||||||
#:use-module (guix packages)
|
#:use-module (guix packages)
|
||||||
#:use-module (guix gexp)
|
#:use-module (guix gexp)
|
||||||
|
#:use-module (oni gexp)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
|
|
||||||
#:export (home-xsession-service-type
|
#:export (home-xsession-service-type
|
||||||
|
@ -20,24 +21,6 @@
|
||||||
(text-config '())
|
(text-config '())
|
||||||
"String"))
|
"String"))
|
||||||
|
|
||||||
(define* (mixed-executable-file name #:key guile #:rest text)
|
|
||||||
"Return an object representing store file NAME containing TEXT. TEXT is a
|
|
||||||
sequence of strings and file-like objects, as in:
|
|
||||||
|
|
||||||
(mixed-text-file \"profile\"
|
|
||||||
\"export PATH=\" coreutils \"/bin:\" grep \"/bin\")
|
|
||||||
|
|
||||||
This is the declarative counterpart of 'text-file*'."
|
|
||||||
(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))
|
|
||||||
|
|
||||||
(define (xsession-home-files config)
|
(define (xsession-home-files config)
|
||||||
`((".xsession"
|
`((".xsession"
|
||||||
,(mixed-executable-file
|
,(mixed-executable-file
|
||||||
|
|
Loading…
Reference in a new issue