summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-06-11 11:09:12 +0200
committerLudovic Courtès <ludo@gnu.org>2015-06-11 11:09:12 +0200
commitc2590362ad7c926050db0ea1dacd437027241520 (patch)
tree65cc6cc0d7f6121a02128db41dc48c6c30e15db1
parent57cd353d87d6e9e6e882327be70b4d7b5ce863ba (diff)
downloadguix-c2590362ad7c926050db0ea1dacd437027241520.tar.gz
environment: Connect to the store after the command line has been parsed.
* guix/scripts/environment.scm (guix-environment): Call 'parse-command-line'
  outside of 'with-store'.  This allows things like --help to run even if the
  daemon is not running.
-rw-r--r--guix/scripts/environment.scm28
1 files changed, 15 insertions, 13 deletions
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index 42178091e6..007fde1606 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -232,20 +232,22 @@ packages."
     (alist-cons 'package arg result))
 
   (with-error-handling
-    (with-store store
-      (let* ((opts  (parse-command-line args %options (list %default-options)
-                                        #:argument-handler handle-argument))
-             (pure? (assoc-ref opts 'pure))
-             (ad-hoc? (assoc-ref opts 'ad-hoc?))
-             (command (assoc-ref opts 'exec))
-             (packages (pick-all (options/resolve-packages opts) 'package))
-             (inputs (if ad-hoc?
+    (let* ((opts     (parse-command-line args %options (list %default-options)
+                                         #:argument-handler handle-argument))
+           (pure?    (assoc-ref opts 'pure))
+           (ad-hoc?  (assoc-ref opts 'ad-hoc?))
+           (command  (assoc-ref opts 'exec))
+           (packages (pick-all (options/resolve-packages opts) 'package))
+           (inputs   (if ad-hoc?
                          (packages+propagated-inputs packages)
-                         (packages->transitive-inputs packages)))
-             (drvs (run-with-store store
-                     (mbegin %store-monad
-                       (set-guile-for-build (default-guile))
-                       (build-inputs inputs opts)))))
+                         (packages->transitive-inputs packages))))
+      (with-store store
+        (define drvs
+          (run-with-store store
+            (mbegin %store-monad
+              (set-guile-for-build (default-guile))
+              (build-inputs inputs opts))))
+
         (cond ((assoc-ref opts 'dry-run?)
                #t)
               ((assoc-ref opts 'search-paths)