utils: Add file-object-or-file-config?.

This commit is contained in:
Hilton Chain committed 2026-06-01 20:03:28 +08:00
1 parent c660951855
commit 05f69100c3
7 files changed
+120 -62

No files matched your search

+12 -1
View File
@@ -5,12 +5,23 @@
;; Utilities
#:use-module (guix gexp)
#:export (file-object?
file-config?
file-object-or-file-config?
user-and-group-id?))
(define (file-object? val)
(or (string? val)
(or (and (string? val)
(string-prefix? "/" val))
(file-like? val)))
(define (file-config? val)
(or (gexp? val)
(pair? val)))
(define (file-object-or-file-config? val)
(or (file-object? val)
(file-config? val)))
(define (user-and-group-id? val)
(or (integer? val)
(eqv? val #f)))