mirror of
https://codeberg.org/hako/Rosenthal.git
synced 2025-09-18 12:44:37 +00:00
utils: computed-substitution-with-inputs: Support directory substitution.
* modules/rosenthal/utils/file.scm (computed-substitution-with-inputs): Support directory substitution. Error when pattern not found.
This commit is contained in:
parent
dff8c3d547
commit
dfe569fdc0
@ -16,11 +16,20 @@
|
||||
(computed-file
|
||||
name
|
||||
#~(begin
|
||||
(use-modules (guix build utils))
|
||||
(use-modules (ice-9 match)
|
||||
(guix build utils))
|
||||
(copy-file #$file #$output)
|
||||
(substitute* #$output
|
||||
(("\\$\\$([^\\$]+)\\$\\$" _ path)
|
||||
(search-path '#$inputs path)))))))
|
||||
(let loop ((candidates '#$inputs))
|
||||
(if (null? candidates)
|
||||
(error "file '~a' not found" path)
|
||||
(match candidates
|
||||
((candidate . rest)
|
||||
(let ((full-path (in-vicinity candidate path)))
|
||||
(if (file-exists? full-path)
|
||||
full-path
|
||||
(loop rest)))))))))))))
|
||||
|
||||
(define (file-content file)
|
||||
(call-with-input-file (canonicalize-path file) get-string-all))
|
||||
|
Loading…
Reference in New Issue
Block a user