Subject: bug#74396: System guix masks modules from pulled 3rd-party channels

From: Tomas Volf <[email-masked]>
Date: Sun, 17 Nov 2024 14:21:24 +0100

Hi,

when system guix produced by the guix-for-channels procedure is
installed, modules in any channel (except in the 'guix) will shadow the
same modules acquired via `guix pull'.

Steps to reproduce:

Have a channels.scm:

--8<---------------cut here---------------start------------->8---
(cons (channel
       (name 'nonguix)
       (url "https://gitlab.com/nonguix/nonguix")
       (introduction
        (make-channel-introduction
         "897c1a470da759236cc11798f4e0a5f7d4d59fbc"
         (openpgp-fingerprint
          "2A39 3FFF 68F4 EF7A 3D29  12AF 6F51 20A0 22FB B2D5"))))
      %default-channels)
--8<---------------cut here---------------end--------------->8---

Pull it, and reconfigure you system using it.  After that is done, try
to search for `nongnu/packages/linux.scm' in the path using `guix repl':

--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> ,use (gnu)
scheme@(guix-user)> (search-path %load-path "nongnu/packages/linux.scm")
$1 = "/gnu/store/svds1ak4zxdnb5sim3h45q5gk7rzqdr0-nonguix/share/guile/site/3.0/nongnu/packages/linux.scm"
--8<---------------cut here---------------end--------------->8---

Notice that the file is located in `/gnu/store/*-nonguix/...'.

Now reconfigure your system with the following modify-services:

--8<---------------cut here---------------start------------->8---
          (modify-services %base-services
            (guix-service-type
             config => (guix-configuration
                        (inherit config)
                        (guix (guix-for-channels
                               (cons (channel
                                      (name 'nonguix)
                                      (url "https://gitlab.com/nonguix/nonguix")
                                      (introduction
                                       (make-channel-introduction
                                        "897c1a470da759236cc11798f4e0a5f7d4d59fbc"
                                        (openpgp-fingerprint
                                         "2A39 3FFF 68F4 EF7A 3D29  12AF 6F51 20A0 22FB B2D5"))))
                                     %default-channels))))))
--8<---------------cut here---------------end--------------->8---

After you reconfigure you system, try to search for the same file again:

--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> ,use (gnu)
scheme@(guix-user)> (search-path %load-path "nongnu/packages/linux.scm")
$1 = "/run/current-system/profile/share/guile/site/3.0/nongnu/packages/linux.scm"
--8<---------------cut here---------------end--------------->8---

Notice that this time it is located in `/run/current-system/...'.

The implication is that any pull of the channels takes no effect, since
the system-wide shadows them.

Have a nice day,
Tomas

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.