diff options
-rw-r--r-- | guix/describe.scm | 10 | ||||
-rw-r--r-- | guix/scripts/repl.scm | 8 |
2 files changed, 16 insertions, 2 deletions
diff --git a/guix/describe.scm b/guix/describe.scm index 6b9b219113..05bf99eb58 100644 --- a/guix/describe.scm +++ b/guix/describe.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2018, 2019 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -43,11 +43,17 @@ ;;; ;;; Code: +(define initial-program-arguments + ;; Save the initial program arguments. This allows us to see the "real" + ;; 'guix' program, even if 'guix repl -s' calls 'set-program-arguments' + ;; later on. + (program-arguments)) + (define current-profile (mlambda () "Return the profile (created by 'guix pull') the calling process lives in, or #f if this is not applicable." - (match (command-line) + (match initial-program-arguments ((program . _) (and (string-suffix? "/bin/guix" program) ;; Note: We want to do _lexical dot-dot resolution_. Using ".." diff --git a/guix/scripts/repl.scm b/guix/scripts/repl.scm index 7d4e474e92..9f20803efc 100644 --- a/guix/scripts/repl.scm +++ b/guix/scripts/repl.scm @@ -27,6 +27,7 @@ #:use-module (srfi srfi-37) #:use-module (ice-9 match) #:use-module (rnrs bytevectors) + #:autoload (guix describe) (current-profile) #:autoload (system repl repl) (start-repl) #:autoload (system repl server) (make-tcp-server-socket make-unix-domain-server-socket) @@ -176,6 +177,13 @@ call THUNK." ;; Run script (save-module-excursion (lambda () + ;; Invoke 'current-profile' so that it memoizes the correct value + ;; based on (program-arguments), before we call + ;; 'set-program-arguments'. This in turn ensures that + ;; (%package-module-path) will contain entries for the channels + ;; available in the current profile. + (current-profile) + (set-program-arguments script) (set-user-module) |