summaryrefslogtreecommitdiff
path: root/guix/store.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludovic.courtes@inria.fr>2017-04-21 19:13:32 +0200
committerLudovic Courtès <ludo@gnu.org>2017-04-21 19:17:36 +0200
commit285f63e805f4a895c1d301efe6d40e93c4e2f704 (patch)
treeabe2a16994bc1362ad6b51a3d8a1efcd1f092c57 /guix/store.scm
parente537833726cb093f101566793e083098d04ac58b (diff)
store: Support 'ssh://' URIs in 'GUIX_DAEMON_SOCKET'.
This allows 'guix' commands to talk to a remote store over SSH. * guix/store.scm (connect-to-daemon)[connect]: Call 'resolve-interface' for unknown URI schemes. * guix/store/ssh.scm: New file. * Makefile.am (MODULES): Add it. * doc/guix.texi (The Store): Document it. Mark remote access as experimental.
Diffstat (limited to 'guix/store.scm')
-rw-r--r--guix/store.scm22
1 files changed, 19 insertions, 3 deletions
diff --git a/guix/store.scm b/guix/store.scm
index 752da98e37..683f071a83 100644
--- a/guix/store.scm
+++ b/guix/store.scm
@@ -411,6 +411,11 @@
(define (connect-to-daemon uri)
"Connect to the daemon at URI, a string that may be an actual URI or a file
name."
+ (define (not-supported)
+ (raise (condition (&nix-connection-error
+ (file uri)
+ (errno ENOTSUP)))))
+
(define connect
(match (string->uri uri)
(#f ;URI is a file name
@@ -428,10 +433,21 @@ name."
(errno EBADR))))) ;bah!
(open-inet-socket (uri-host uri) (uri-port uri))))
+ ((? symbol? scheme)
+ ;; Try to dynamically load a module for SCHEME.
+ ;; XXX: Errors are swallowed.
+ (match (false-if-exception
+ (resolve-interface `(guix store ,scheme)))
+ ((? module? module)
+ (match (false-if-exception
+ (module-ref module 'connect-to-daemon))
+ ((? procedure? connect)
+ (lambda (_)
+ (connect uri)))
+ (x (not-supported))))
+ (#f (not-supported))))
(x
- (raise (condition (&nix-connection-error
- (file (uri->string uri))
- (errno ENOTSUP)))))))))
+ (not-supported))))))
(connect uri))