Emacs load path and module loading issues with Guix Home on Foreign

Background

I’m setting up Emacs (using my normal init.el) on Guix (with home) over Arch. I previously just ran it on Arch. While I did have Guix installed, I didn’t have a Guix home setup so it wasn’t doing much with my environment variables. I use Elpaca for my Emacs package management.

Problems

Unfortunately, something Guix is doing is interfering Emacs working properly, specifically in terms of loading packages and dynamic modules (in my case, libenchant for Jinx).

When I run a native Arch install of Emacs (i.e. /usr/bin/emacs), none of the Guix stuff loads correctly:

startup--load-user-init-file: Cannot open load file: No such file or directory, warningsError muted by safe_call: (apply native--compile-async ("/home/test/.guix-home/profile/share/emacs/site-lisp/guix-emacs.el" nil late)) signaled (file-missing "Cannot open load file" "No such file or directory" "comp-run")
Error muted by safe_call: (apply native--compile-async ("/home/test/.guix-home/profile/share/emacs/site-lisp/guix-emacs.el" nil late)) signaled (file-missing "Cannot open load file" "No such file or directory" "comp-run") [5 times]

I assume this has something to do with how Emacs on Guix uses a minimal Emacs worker to compile things, but I’m not sure exactly how that works and why it should not work from the native Emacs install.

Regardless, the effect is that it will not load properly.

When I run the native Arch install without the Emacs load path env variable set (i.e. EMACSLOADPATH="" /usr/bin/emacs, everything works how it did before on my plain Arch install (including Jinx loading its dynamic module correctly).

When I run the Guix install with or without the EMACSLOADPATH variable set, most of my config loads correctly, but Jinx can’t load its dynamic module.

Specifically I get this error:

jinx--load-module: Module could not be opened: "/home/test/.emacs.d/elpaca/builds/jinx/jinx-mod.so", "libenchant-2.so.2: cannot open shared object file: No such file or directory"

While it claims that libenchant-2.so.2 does not exist, I do have it installed, and both ldd and pkgconf (which Jinx uses to load the module) are able to find it.

$ ldd .emacs.d/elpaca/builds/jinx/jinx-mod.so 
        linux-vdso.so.1 (0x00007fea8c2fe000)
        libenchant-2.so.2 => /usr/lib/libenchant-2.so.2 (0x00007fea8c2c5000)       
        libc.so.6 => /usr/lib/libc.so.6 (0x00007fea8c000000)
        libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x00007fea8c266000)   
        libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0x00007fea8c25f000)   
        libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00007fea8beaa000)
        /usr/lib64/ld-linux-x86-64.so.2 (0x00007fea8c300000)
        libffi.so.8 => /usr/lib/libffi.so.8 (0x00007fea8c251000)
        libpcre2-8.so.0 => /usr/lib/libpcre2-8.so.0 (0x00007fea8bdfe000)
$ pkgconf --list-all | grep libenchant
enchant-2                      libenchant - A spell checking library

I’ll be the first to admit that I know very little about C library loading but it seems really odd that changing the installation of Emacs should be effecting this unless Guix is going in and messing with that somehow in their install.

While I do like Guix, I don’t really have the time to switch my entire Emacs config over to using it instead of Elpaca (and honestly I like Elpaca’s style a bit better for Emacs packages in the general case because it makes development stuff easy).

Does anyone know how I should manage this? I really want to keep the Guix home (lots of the other stuff it does is very useful) and I don’t particularly want to put EMACSLOADPATH="" /usr/bin/emacs into every call to Emacs in the rest of my configuration. How do get Emacs (preferably the Guix install) to find the module for Jinx? Or am I going about all this wrong and I should only be using the Guix install version if I’m going full Guix package management and dropping Elpaca.

For now, I will probably just put unset EMACSLOADPATH in my Guix home profile, but this seems overly drastic and precludes me from using any Guix features with Emacs.