aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemse2022-04-15 22:13:33 -0700
committerGravatar Tom Willemse2022-04-15 22:13:33 -0700
commitb157ecf8ff48188850d250a0bee798a671fd4330 (patch)
tree37bdff4a0d14a49efa2098e411f9e31d24e42c88
parentaf4c5b3ffdbceface86441c8c4e19e52040ae7c7 (diff)
downloadnew-dotfiles-b157ecf8ff48188850d250a0bee798a671fd4330.tar.gz
new-dotfiles-b157ecf8ff48188850d250a0bee798a671fd4330.zip
Centralize definition of ‘mixed-executable-file’
-rw-r--r--oni/gexp.scm20
-rw-r--r--oni/home/services/herbstluftwm.scm19
-rw-r--r--oni/home/services/xsession.scm19
3 files changed, 22 insertions, 36 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))
diff --git a/oni/home/services/herbstluftwm.scm b/oni/home/services/herbstluftwm.scm
index e69a17c..26b79c9 100644
--- a/oni/home/services/herbstluftwm.scm
+++ b/oni/home/services/herbstluftwm.scm
@@ -7,6 +7,7 @@
#:use-module (guix packages)
#:use-module (guix gexp)
#:use-module (oni home services xsession)
+ #:use-module (oni gexp)
#:use-module (srfi srfi-1)
#:export (home-herbstluftwm-service-type
@@ -47,24 +48,6 @@
(define (add-herbstluftwm-packages 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)
(apply mixed-executable-file
"autostart"
diff --git a/oni/home/services/xsession.scm b/oni/home/services/xsession.scm
index c6f06e7..9208235 100644
--- a/oni/home/services/xsession.scm
+++ b/oni/home/services/xsession.scm
@@ -4,6 +4,7 @@
#:use-module (gnu home services utils)
#:use-module (guix packages)
#:use-module (guix gexp)
+ #:use-module (oni gexp)
#:use-module (srfi srfi-1)
#:export (home-xsession-service-type
@@ -20,24 +21,6 @@
(text-config '())
"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)
`((".xsession"
,(mixed-executable-file