mirror of
https://codeberg.org/hako/Rosenthal.git
synced 2026-11-29 22:58:06 +00:00
utils: Add helper procedures from my dotfiles.
* modules/rosenthal/utils/packages.scm (delete-package-from-list, pkg) (pkg+out, pkgs, pkgs+out): New procedures. * modules/rosenthal/utils/file.scm (computed-substitution-with-inputs) (file-content): New procedures.
This commit is contained in:
2 files changed
+49
-8
No files matched your search
@@ -0,0 +1,22 @@
|
||||
;;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
;;; Copyright © 2025 Hilton Chain <hako@ultrarare.space>
|
||||
|
||||
(define-module (rosenthal utils file)
|
||||
#:use-module (ice-9 textual-ports)
|
||||
#:use-module (guix gexp)
|
||||
#:export (computed-substitution-with-inputs
|
||||
file-content))
|
||||
|
||||
(define (computed-substitution-with-inputs name file inputs)
|
||||
(with-imported-modules '((guix build utils))
|
||||
(computed-file
|
||||
name
|
||||
#~(begin
|
||||
(use-modules (guix build utils))
|
||||
(copy-file #$file #$output)
|
||||
(substitute* #$output
|
||||
(("\\$\\$([^\\$]+)\\$\\$" _ path)
|
||||
(search-path '#$inputs path)))))))
|
||||
|
||||
(define (file-content file)
|
||||
(call-with-input-file (canonicalize-path file) get-string-all))
|
||||
Reference in new issue
Block a user