There are dozens of Guile libraries in Nixpkgs. Their recipes show that the upstream installation locations are either left nearly untouched (guile-ssh, guile-zstd), or modified like either
postPatch = ''
substituteInPlace configure.ac \
--replace 'SITEDIR="$datadir/guile-lib"' 'SITEDIR=$datadir/guile/site/$GUILE_EFFECTIVE_VERSION' \
--replace 'SITECCACHEDIR="$libdir/guile-lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache"' 'SITECCACHEDIR="$libdir/guile/$GUILE_EFFECTIVE_VERSION/site-ccache"'
'';
(as in guile-lib)
or
configureFlags = [
"--with-guile-site-dir=$(out)/${guile.siteDir}"
"--with-guile-site-ccache-dir=$(out)/${guile.siteCcacheDir}"
];
(as in guile-xcb)
However, inside a nix shell
containing such packages above, the Guile variable %load-path
just evaluates to something like
("/nix/store/<hash>-guile-3.0.10/share/guile/3.0" "/nix/store/<hash>-guile-3.0.10/share/guile/site/3.0" "/nix/store/<hash>-guile-3.0.10/share/guile/site" "/nix/store/<hash>-guile-3.0.10/share/guile")
and use-modules
shows that there is no code for module
of these libraries.
I guess this is because Guile does not search for the “Nix site” libraries automatically, even if their locations follow the convention of Guile (in spite of being separated in a Nixy way), and (as far as I know) there’s no such thing as guile.withPackages
. I wonder how can I use them without adding the paths manually to %load-path
.