gnu: Add r-flowsom.
[jackhill/guix/guix.git] / guix / remote.scm
index e503c76..5fecd95 100644 (file)
@@ -46,7 +46,7 @@
     (compose object->string object->string))
 
   (apply open-remote-pipe* session OPEN_READ
-         (string-append (derivation->output-path
+         (string-append (derivation-input-output-path
                          (lowered-gexp-guile lowered))
                         "/bin/guile")
          "--no-auto-compile"
@@ -76,8 +76,14 @@ result to the current output port using the (guix repl) protocol."
   (with-imported-modules (source-module-closure '((guix repl)))
     #~(begin
         (use-modules (guix repl))
-        (send-repl-response '(primitive-load #$program)
+
+        ;; We use CURRENT-OUTPUT-PORT for REPL messages, so redirect PROGRAM's
+        ;; output to CURRENT-ERROR-PORT so that it does not interfere.
+        (send-repl-response '(with-output-to-port (current-error-port)
+                               (lambda ()
+                                 (primitive-load #$program)))
                             (current-output-port))
+
         (force-output))))
 
 (define* (remote-eval exp session
@@ -95,40 +101,27 @@ remote store."
                       (remote -> (connect-to-remote-daemon session
                                                            socket-name)))
     (define inputs
-      (cons (gexp-input (lowered-gexp-guile lowered))
+      (cons (lowered-gexp-guile lowered)
             (lowered-gexp-inputs lowered)))
 
-    (define to-build
-      (map (lambda (input)
-             (if (derivation? (gexp-input-thing input))
-                 (cons (gexp-input-thing input)
-                       (gexp-input-output input))
-                 (gexp-input-thing input)))
-           inputs))
+    (define sources
+      (lowered-gexp-sources lowered))
 
     (if build-locally?
-        (let ((to-send (map (lambda (input)
-                              (match (gexp-input-thing input)
-                                ((? derivation? drv)
-                                 (derivation->output-path
-                                  drv (gexp-input-output input)))
-                                ((? store-path? item)
-                                 item)))
-                            inputs)))
+        (let ((to-send (append (append-map derivation-input-output-paths
+                                           inputs)
+                               sources)))
           (mbegin %store-monad
-            (built-derivations to-build)
+            (built-derivations inputs)
             ((store-lift send-files) to-send remote #:recursive? #t)
             (return (close-connection remote))
             (return (%remote-eval lowered session))))
-        (let ((to-send (map (lambda (input)
-                              (match (gexp-input-thing input)
-                                ((? derivation? drv)
-                                 (derivation-file-name drv))
-                                ((? store-path? item)
-                                 item)))
-                            inputs)))
+        (let ((to-send (append (map (compose derivation-file-name
+                                             derivation-input-derivation)
+                                    inputs)
+                               sources)))
           (mbegin %store-monad
             ((store-lift send-files) to-send remote #:recursive? #t)
-            (return (build-derivations remote to-build))
+            (return (build-derivations remote inputs))
             (return (close-connection remote))
             (return (%remote-eval lowered session)))))))