metznet-channel/channels.scm

28 lines
1.2 KiB
Scheme

;; channels.scm -- reads the channels.d dir to get a list of channel objects
;;
;; `guix pull` also compiles every .scm file under this channel's own
;; checkout as an ordinary package module (see standard-module-derivation)
;; and then loads each by its path-derived module name (e.g. this file as
;; (channels)) to build the package cache -- so, like metznet/machines/*.scm,
;; this needs a real define-module matching its path, not just a bare
;; script relying on guix pull -C's implicit (guix channels) import.
(define-module (channels)
#:use-module (gnu)
#:use-module (guix channels)
#:use-module ((ice-9 ftw) #:select (scandir)))
;; ./channels.d only resolves when the process's CWD happens to be this
;; file's own directory, which isn't true once guix pull loads this as a
;; plain module (e.g. from the store) to build its package cache -- anchor
;; to this file's own location instead.
(define here (dirname (current-filename)))
(define channels-directory (string-append here "/channels.d"))
(define channel-files
(scandir channels-directory
(lambda (file)
(string-suffix? ".scm" file))))
(append (map (lambda (file) (load (string-append channels-directory "/" file))) channel-files) %default-channels)