summary refs log tree commit diff
path: root/doc/guix.texi
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-10-01 22:47:33 +0200
committerLudovic Courtès <ludo@gnu.org>2021-10-25 19:02:33 +0200
commit9730692d9f06f8c412b45ef108006921298983c4 (patch)
treef778fff90b81323c47612419710fd26e40f912df /doc/guix.texi
parent2cb0b3709ace41078872578f657ab0ee45d20ac9 (diff)
downloadguix-9730692d9f06f8c412b45ef108006921298983c4.tar.gz
shell: Maintain a profile cache.
shell: Maintain a profile cache.

With this change, running "guix shell" (no arguments) is equivalent to:

  guix environment -r ~/.cache/guix/profiles/some-root -l guix.scm

This is the cache miss.  On cache hit, it's equivalent to:

  guix environment -p ~/.cache/guix/profiles/some-root

... which can run in 0.1s.

* guix/scripts/shell.scm (options-with-caching): New procedure.
(parse-args): Use it.
(%profile-cache-directory): New variable.
(profile-cache-key, profile-cached-gc-root): New procedures.
(show-help, %options): Add '--rebuild-cache'.
(guix-shell)[cache-entries, entry-expiration]: New procedures.
Add call to 'maybe-remove-expired-cache-entries'.
* doc/guix.texi (Invoking guix shell): Document '--rebuild-cache'.
Diffstat (limited to 'doc/guix.texi')
-rw-r--r--doc/guix.texi11
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 5809bbacd4..093e354509 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -5769,6 +5769,17 @@ This is similar to the same-named option in @command{guix package}
 (@pxref{profile-manifest, @option{--manifest}}) and uses the same
 manifest files.
 
+@item --rebuild-cache
+When using @option{--manifest}, @option{--file}, or when invoked without
+arguments, @command{guix shell} caches the environment so that
+subsequent uses are instantaneous.  The cache is invalidated anytime the
+file is modified.
+
+The @option{--rebuild-cache} forces the cached environment to be
+refreshed even if the file has not changed.  This is useful if the
+@command{guix.scm} or @command{manifest.scm} has external dependencies,
+or if its behavior depends, say, on environment variables.
+
 @item --pure
 Unset existing environment variables when building the new environment, except
 those specified with @option{--preserve} (see below).  This has the effect of