aboutsummaryrefslogtreecommitdiff
path: root/guix/inferior.scm
diff options
context:
space:
mode:
authorKonrad Hinsen <konrad.hinsen@fastmail.net>2019-10-25 17:42:21 +0200
committerLudovic Courtès <ludo@gnu.org>2019-11-15 23:28:17 +0100
commitf675f8dec73d02e319e607559ed2316c299ae8c7 (patch)
treeb8188a70e7cfc211b40a3406aeefd185b129b64c /guix/inferior.scm
parent1edcfda81ba5c20ca715473d45315662c60dd81e (diff)
downloadguix-f675f8dec73d02e319e607559ed2316c299ae8c7.tar
guix-f675f8dec73d02e319e607559ed2316c299ae8c7.tar.gz
Add 'guix time-machine'.
* guix/scripts/time-machine.scm: New file. * Makefile.am: (MODULES): Add it. * guix/scripts/pull.scm (channel-list): Export. * guix/inferior.scm (cached-channel-instance): New procedure. (inferior-for-channels): Use it. * doc/guix.texi (Invoking guix time-machine): New section. (Channels): Cross-reference it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'guix/inferior.scm')
-rw-r--r--guix/inferior.scm38
1 files changed, 26 insertions, 12 deletions
diff --git a/guix/inferior.scm b/guix/inferior.scm
index b8e2f21f42..be50e0ec26 100644
--- a/guix/inferior.scm
+++ b/guix/inferior.scm
@@ -89,6 +89,7 @@
gexp->derivation-in-inferior
%inferior-cache-directory
+ cached-channel-instance
inferior-for-channels))
;;; Commentary:
@@ -635,16 +636,13 @@ failing when GUIX is too old and lacks the 'guix repl' command."
(make-parameter (string-append (cache-directory #:ensure? #f)
"/inferiors")))
-(define* (inferior-for-channels channels
- #:key
- (cache-directory (%inferior-cache-directory))
- (ttl (* 3600 24 30)))
- "Return an inferior for CHANNELS, a list of channels. Use the cache at
-CACHE-DIRECTORY, where entries can be reclaimed after TTL seconds. This
-procedure opens a new connection to the build daemon.
-
-This is a convenience procedure that people may use in manifests passed to
-'guix package -m', for instance."
+(define* (cached-channel-instance channels
+ #:key
+ (cache-directory (%inferior-cache-directory))
+ (ttl (* 3600 24 30)))
+ "Return a directory containing a guix filetree defined by CHANNELS, a list of channels.
+The directory is a subdirectory of CACHE-DIRECTORY, where entries can be reclaimed after TTL seconds.
+This procedure opens a new connection to the build daemon."
(with-store store
(let ()
(define instances
@@ -680,7 +678,7 @@ This is a convenience procedure that people may use in manifests passed to
(file-expiration-time ttl))
(if (file-exists? cached)
- (open-inferior cached)
+ cached
(run-with-store store
(mlet %store-monad ((profile
(channel-instances->derivation instances)))
@@ -689,4 +687,20 @@ This is a convenience procedure that people may use in manifests passed to
(built-derivations (list profile))
(symlink* (derivation->output-path profile) cached)
(add-indirect-root* cached)
- (return (open-inferior cached)))))))))
+ (return cached))))))))
+
+(define* (inferior-for-channels channels
+ #:key
+ (cache-directory (%inferior-cache-directory))
+ (ttl (* 3600 24 30)))
+ "Return an inferior for CHANNELS, a list of channels. Use the cache at
+CACHE-DIRECTORY, where entries can be reclaimed after TTL seconds. This
+procedure opens a new connection to the build daemon.
+
+This is a convenience procedure that people may use in manifests passed to
+'guix package -m', for instance."
+ (define cached
+ (cached-channel-instance channels
+ #:cache-directory cache-directory
+ #:ttl ttl))
+ (open-inferior cached))