metznet-channel/channels.scm

19 lines
903 B
Scheme

;; channels.scm -- reads the channels.d dir to get a list of channel objects
;; guix pull -C pre-imports (guix channels) into the file's environment
;; (see load-channels/make-user-module in guix/scripts/pull.scm), which is
;; why this worked without an explicit import. But `guix pull` also
;; compiles every .scm file under this channel's own checkout as an
;; ordinary package module (see standard-module-derivation), and that
;; environment does NOT pre-import it -- so `channel` (a macro from (guix
;; channels), used in channels.d/*.scm) and %default-channels come up
;; unbound there unless imported explicitly.
(use-modules (gnu) (guix channels) ((ice-9 ftw) #:select (scandir)))
(define channel-files
(scandir "./channels.d"
(lambda (file)
(string-suffix? ".scm" file))))
(append (map (lambda (file) (load (string-append "./channels.d/" file))) channel-files) %default-channels)