From e51cb7845662d6e2e89025a765874659051ef4b8 Mon Sep 17 00:00:00 2001 From: Noah Metz Date: Tue, 28 Jul 2026 22:05:52 -0600 Subject: [PATCH] Anchor channels.d path to channels.scm's own location, not CWD "./channels.d" only resolved because guix pull -C channels.scm happened to be invoked with CWD == this file's directory. Once guix pull loads this file as a plain module (e.g. from the store, to build its package cache), CWD is unrelated to the checkout, so scandir returned #f and map blew up with "Not a list: #f". Use (current-filename) instead so it works regardless of how/where this file gets loaded from. --- channels.scm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/channels.scm b/channels.scm index d37ae87..bef641f 100644 --- a/channels.scm +++ b/channels.scm @@ -11,9 +11,17 @@ #: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.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)