|
|
|
|
@ -1,18 +1,27 @@
|
|
|
|
|
;; 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)))
|
|
|
|
|
|
|
|
|
|
;; 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)))
|
|
|
|
|
;; ./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.d"
|
|
|
|
|
(scandir channels-directory
|
|
|
|
|
(lambda (file)
|
|
|
|
|
(string-suffix? ".scm" file))))
|
|
|
|
|
|
|
|
|
|
(append (map (lambda (file) (load (string-append "./channels.d/" file))) channel-files) %default-channels)
|
|
|
|
|
(append (map (lambda (file) (load (string-append channels-directory "/" file))) channel-files) %default-channels)
|
|
|
|
|
|