aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-06-13 23:11:35 +0100
committerChristopher Baines <mail@cbaines.net>2019-06-13 23:11:35 +0100
commit11144a5fe92dadfd1f60a7bd9ada2669cffc1e13 (patch)
treee80c15e45dcc3bdda210cc57c1694ea6aa8a4c34
parent6f379c7937fe5311d48640fd96c02e2fab5bbcf0 (diff)
downloaddata-service-11144a5fe92dadfd1f60a7bd9ada2669cffc1e13.tar
data-service-11144a5fe92dadfd1f60a7bd9ada2669cffc1e13.tar.gz
Catch the guix available when built
And use it for the hosting the inferiors, rather than computing the guix package at runtime. This simplifies the behaviour when the Guix Data Service is deployed as a Guix package.
-rw-r--r--configure.ac2
-rw-r--r--guix-data-service/config.scm.in2
-rw-r--r--guix-data-service/jobs/load-new-guix-revision.scm34
3 files changed, 26 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac
index 7952277..a50d90b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,6 +35,8 @@ guilemoduledir="${datarootdir}/guile/site/${GUILE_EFFECTIVE_VERSION}"
AC_SUBST([guilemoduledir])
AC_SUBST([GUILE_EFFECTIVE_VERSION])
+AC_PATH_PROG([guix], [guix])
+
AC_PATH_PROG([sqitch], [sqitch])
AC_PATH_PROG([psql], [psql])
diff --git a/guix-data-service/config.scm.in b/guix-data-service/config.scm.in
index 12572c2..20323c6 100644
--- a/guix-data-service/config.scm.in
+++ b/guix-data-service/config.scm.in
@@ -33,6 +33,8 @@
(host . "localhost")
(port . 8765)
+ (guix . "@guix@")
+
(sqitch . "@sqitch@")
(sqitch-psql . "@psql@")
(sqitch-plan . ,(let ((installed-plan
diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm
index c51e91e..5ce8c4c 100644
--- a/guix-data-service/jobs/load-new-guix-revision.scm
+++ b/guix-data-service/jobs/load-new-guix-revision.scm
@@ -12,6 +12,7 @@
#:use-module (guix packages)
#:use-module (guix derivations)
#:use-module (guix build utils)
+ #:use-module (guix-data-service config)
#:use-module (guix-data-service model package)
#:use-module (guix-data-service model git-repository)
#:use-module (guix-data-service model guix-revision)
@@ -245,18 +246,27 @@
(if (and store-path
(file-exists? store-path))
store-path
- (begin
- (invalidate-derivation-caches!)
- (hash-clear! (@@ (guix packages) %derivation-cache))
- (let* ((guix-package (@ (gnu packages package-management)
- guix))
- (derivation (package-derivation store guix-package)))
- (build-derivations store (list derivation))
-
- (let ((new-store-path
- (derivation->output-path derivation)))
- (set! store-path new-store-path)
- new-store-path)))))))
+ (let ((config-guix (%config 'guix)))
+ (if (and (file-exists? config-guix)
+ (string-prefix? "/gnu/store/" config-guix))
+ (begin
+ (set! store-path
+ (dirname
+ (dirname
+ (%config 'guix))))
+ store-path)
+ (begin
+ (invalidate-derivation-caches!)
+ (hash-clear! (@@ (guix packages) %derivation-cache))
+ (let* ((guix-package (@ (gnu packages package-management)
+ guix))
+ (derivation (package-derivation store guix-package)))
+ (build-derivations store (list derivation))
+
+ (let ((new-store-path
+ (derivation->output-path derivation)))
+ (set! store-path new-store-path)
+ new-store-path)))))))))
(define (nss-certs-store-path store)
(let* ((nss-certs-package (@ (gnu packages certs)