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.
This commit is contained in:
Ludovic Courtès 2019-02-03 22:13:55 +01:00
parent a87d66f371
commit 765a5bf167
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 13 additions and 3 deletions

@ -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)))))))

@ -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"))