Alex Kost <alez...@gmail.com> writes:

> Alex Vong (2017-06-29 12:28 +0800) wrote:
>
>> "Feng Shu" <tuma...@163.com> writes:
>>
>>> Now I have found that 'guix pull' is too slow,
>>> I need 3 hours to compile guix, is it possible to speed it ?
>>
>> Maybe you can try building from git instead? I used to run
>> '$ guix pull && guix package --upgrade', but it gets slower as the
>> number of packages of guix increases. So now I use
>> '$ git pull && make -j`nproc` && ./pre-inst-env guix package --upgrade'.
>> You can read the manual[0] for more info.
>>
>> If you use emacs-guix, you need to tell emacs-guix the location of your
>> git repository as well. I am unware of how others do it. Here is how I
>> do it:
>>
>>   (require 'guix-autoloads)
>
> I always recommend avoid such "hard" requiring, it is better to use
> (require 'foo nil t) instead.  With (require 'foo), your emacs config
> will be really fragile: once 'foo' feature will disappear (renamed or
> 'foo' package will be uninstalled, etc.), Emacs will fail loading your
> config!  So I would use (require 'guix-autoloads nil t) instead.
>
>>   (guix-prettify-global-mode)
>
> For the same reason, I never call functions from external packages in my
> emacs config: what if this function disappear one day? (I don't mean I'm
> going to remove it).  If I need to load something on Emacs start, I add
> it to 'after-init-hook'.  If it is going to fail, at least it will fail
> after your config will be fully loaded.
>
Is there an intermediate approch? Is is possible for Emacs to signal a
warning when the required features are not found, but still continue
loading the rest of the config?

>>   (setq-default guix-current-profile
>>                 (file-chase-links "~/.guix-profile" 1))
>
> Hm, I don't think this is needed.  Doesn't Emacs-Guix work with the
> default 'guix-current-profile' setting?
>
>>   (require 'guix-build-config)
>>   (let ((guix-src-dir (expand-file-name "~/scm/guix/")))
>>     (setq-default guix-config-image-directory guix-src-dir)
>>     (setq-default guix-config-guix-scheme-compiled-directory guix-src-dir))
>
> I have never had a need to set these variables.  Setting image directory
> is definitely not needed (if the default value doesn't work for you,
> it's a bug).
>
> As for the directory with Guix compiled files, although you can set it,
> it is not really intended for customizing.  Do you have
> "~/.config/guix/latest" point to "~/scm/guix"?  Or do you add
> "~/scm/guix" to GUILE_LOAD_PATH and GUILE_LOAD_COMPILED_PATH?  Or do you
> add it to 'geiser-guile-load-path'?  If anything of this is true, then
> you don't need to set that variable.

Thanks for the suggestion! It turns out setting NIX_STATE_DIR to
"/usr/local/var/guix/" and making "~/.config/guix/latest" pointing to
"~/scm/guix/" completely resolves the problem. So now only a oneliner is
required:

  (require 'guix-autoloads '() t)

Do you think it is a bug that Emacs-Guix does not set
`guix-state-directory' correctly?

Attachment: signature.asc
Description: PGP signature

Reply via email to