summary refs log tree commit diff
path: root/build-aux/build-self.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-06-18 23:56:16 +0200
committerLudovic Courtès <ludo@gnu.org>2018-06-18 23:56:16 +0200
commit7af5c2a248b6c229187fc850517c84b0917c452b (patch)
tree5b6540c0abb003d00354ab436ff281ea489f6cd4 /build-aux/build-self.scm
parentd6b5aa0b031f0e7091f7424ac616d1c4d10fed5b (diff)
downloadguix-7af5c2a248b6c229187fc850517c84b0917c452b.tar.gz
self: Define derived '-directory' variables in config.scm.
This is a followup to d6b5aa0b031f0e7091f7424ac616d1c4d10fed5b.

* guix/self.scm (%config-variables): Remove %CONFIG-DIRECTORY,
%STATE-DIRECTORY, %STORE-DATABASE-DIRECTORY, and %STORE-DIRECTORY.
(make-config.scm): Define them here.
* build-aux/build-self.scm (%config-variables, make-config.scm):
Likewise.
Diffstat (limited to 'build-aux/build-self.scm')
-rw-r--r--build-aux/build-self.scm30
1 files changed, 25 insertions, 5 deletions
diff --git a/build-aux/build-self.scm b/build-aux/build-self.scm
index 22c4031c2e..bd285bcedd 100644
--- a/build-aux/build-self.scm
+++ b/build-aux/build-self.scm
@@ -70,11 +70,7 @@
                                ((_ variable rest ...)
                                 (cons `(variable . ,variable)
                                       (variables rest ...))))))
-    (variables %config-directory %localstatedir %state-directory
-               ;; Note: No '%store-database-directory', which is too recent
-               ;; and unnecessary anyway.
-               %store-directory
-               %storedir %sysconfdir %system)))
+    (variables %localstatedir %storedir %sysconfdir %system)))
 
 (define* (make-config.scm #:key libgcrypt zlib gzip xz bzip2
                           (package-name "GNU Guix")
@@ -92,6 +88,10 @@
                                %guix-version
                                %guix-bug-report-address
                                %guix-home-page-url
+                               %store-directory
+                               %state-directory
+                               %store-database-directory
+                               %config-directory
                                %libgcrypt
                                %libz
                                %gzip
@@ -105,6 +105,26 @@
                                 #~(define-public #$name #$value)))
                              %config-variables)
 
+                     (define %store-directory
+                       (or (and=> (getenv "NIX_STORE_DIR") canonicalize-path)
+                           %storedir))
+
+                     (define %state-directory
+                       ;; This must match `NIX_STATE_DIR' as defined in
+                       ;; `nix/local.mk'.
+                       (or (getenv "NIX_STATE_DIR")
+                           (string-append %localstatedir "/guix")))
+
+                     (define %store-database-directory
+                       (or (getenv "NIX_DB_DIR")
+                           (string-append %state-directory "/db")))
+
+                     (define %config-directory
+                       ;; This must match `GUIX_CONFIGURATION_DIRECTORY' as
+                       ;; defined in `nix/local.mk'.
+                       (or (getenv "GUIX_CONFIGURATION_DIRECTORY")
+                           (string-append %sysconfdir "/guix")))
+
                      (define %guix-package-name #$package-name)
                      (define %guix-version #$package-version)
                      (define %guix-bug-report-address #$bug-report-address)