guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/05: self: Ensure the daemon refers to the right 'guix' command.


From: guix-commits
Subject: 03/05: self: Ensure the daemon refers to the right 'guix' command.
Date: Sun, 3 Feb 2019 18:03:40 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 765a5bf1677ad6bc77ed65df4f63da9ef77bb55a
Author: Ludovic Courtès <address@hidden>
Date:   Sun Feb 3 22:13:55 2019 +0100

    self: Ensure the daemon refers to the right 'guix' command.
    
    Previously it would refer to
    /var/guix/profiles/per-user/root/current-guix/bin/guix, which would fail
    when that profile does not exist.  This is notably the case when using
    'channel-instance->package' as done in commit
    7e6d8d366a61f951936ed83371877ce006f679f6.
    
    * gnu/packages/package-management.scm (guix-daemon)[arguments]: In
    'install phase, honor environment variable 'GUIX'.
    * guix/self.scm (whole-package)[wrap]: New procedure.
    Use it.
---
 gnu/packages/package-management.scm |  2 +-
 guix/self.scm                       | 14 ++++++++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/package-management.scm 
b/gnu/packages/package-management.scm
index ef38a6f..c52f5e3 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -356,7 +356,7 @@ the Nix package manager.")
                (let ((out (assoc-ref outputs "out")))
                  (substitute* (find-files (string-append out "/libexec"))
                    (("exec \".*/bin/guix\"")
-                    "exec 
/var/guix/profiles/per-user/root/current-guix/bin/guix"))
+                    "exec 
\"${GUIX:-/var/guix/profiles/per-user/root/current-guix/bin/guix}\""))
                  #t)))
            (delete 'wrap-program)))))))
 
diff --git a/guix/self.scm b/guix/self.scm
index 68f5641..a45470a 100644
--- a/guix/self.scm
+++ b/guix/self.scm
@@ -460,17 +460,27 @@ load path."
 the modules (under share/guile/site and lib/guile), and DEPENDENCIES, a list
 of packages depended on.  COMMAND is the 'guix' program to use; INFO is the
 Info manual."
+  (define (wrap daemon)
+    (program-file "guix-daemon"
+                  #~(begin
+                      (setenv "GUIX" #$command)
+                      (apply execl #$(file-append daemon "/bin/guix-daemon")
+                             "guix-daemon" (cdr (command-line))))))
+
   (computed-file name
                  (with-imported-modules '((guix build utils))
                    #~(begin
                        (use-modules (guix build utils))
 
+                       (define daemon
+                         #$(and daemon (wrap daemon)))
+
                        (mkdir-p (string-append #$output "/bin"))
                        (symlink #$command
                                 (string-append #$output "/bin/guix"))
 
-                       (when #$daemon
-                         (symlink (string-append #$daemon "/bin/guix-daemon")
+                       (when daemon
+                         (symlink daemon
                                   (string-append #$output "/bin/guix-daemon")))
 
                        (let ((share (string-append #$output "/share"))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]