summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-05-26 22:01:42 +0200
committerLudovic Courtès <ludo@gnu.org>2019-05-26 22:01:42 +0200
commitdfc69e4b6d4bbc41a4d37b3cc6ea12adb34aaafa (patch)
treecf26ec2c2e3c82732aae12efcc2bf9374587860b
parent45bdb6625115959dbf3874b69f89dd506b68fbb6 (diff)
downloadguix-dfc69e4b6d4bbc41a4d37b3cc6ea12adb34aaafa.tar.gz
self: 'guix-daemon' honors %localstatedir, %sysconfdir, and %storedir.
Fixes <https://bugs.gnu.org/35874>.
Reported by Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>.

Previously, the 'guix-daemon' program provided by 'guix pull' would
systematically use default directory locations for these.

* guix/self.scm (whole-package)[wrap]: Set GUIX_STATE_DIRECTORY,
GUIX_CONFIGURATION_DIRECTORY, and NIX_STORE_DIR.
-rw-r--r--guix/self.scm14
1 files changed, 14 insertions, 0 deletions
diff --git a/guix/self.scm b/guix/self.scm
index 6d7569ec19..8cc82de64c 100644
--- a/guix/self.scm
+++ b/guix/self.scm
@@ -603,7 +603,21 @@ Info manual."
   (define (wrap daemon)
     (program-file "guix-daemon"
                   #~(begin
+                      ;; Refer to the right 'guix' command for 'guix
+                      ;; substitute' & co.
                       (setenv "GUIX" #$command)
+
+                      ;; Honor the user's settings rather than those hardcoded
+                      ;; in the 'guix-daemon' package.
+                      (unless (getenv "GUIX_STATE_DIRECTORY")
+                        (setenv "GUIX_STATE_DIRECTORY"
+                                #$(string-append %localstatedir "/guix")))
+                      (unless (getenv "GUIX_CONFIGURATION_DIRECTORY")
+                        (setenv "GUIX_CONFIGURATION_DIRECTORY"
+                                #$(string-append %sysconfdir "/guix")))
+                      (unless (getenv "NIX_STORE_DIR")
+                        (setenv "NIX_STORE_DIR" %storedir))
+
                       (apply execl #$(file-append daemon "/bin/guix-daemon")
                              "guix-daemon" (cdr (command-line))))))