diff options
author | Christopher Baines <mail@cbaines.net> | 2019-02-23 20:15:35 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-02-23 20:15:35 +0000 |
commit | 83832a78627c3c4511a8d6595f855628124d1b41 (patch) | |
tree | 212a49c90ad99dc6728e119a10bcb896e8286ec1 | |
parent | c6949a27109ef74a3dcc131c587393dd86c40e68 (diff) | |
download | data-service-83832a78627c3c4511a8d6595f855628124d1b41.tar data-service-83832a78627c3c4511a8d6595f855628124d1b41.tar.gz |
Build new Guix revisions within an inferior
Once inferiors can provide some isolation, this will make building
guix in this way safer.
-rw-r--r-- | guix-data-service/jobs/load-new-guix-revision.scm | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm index ea1909a..783b74f 100644 --- a/guix-data-service/jobs/load-new-guix-revision.scm +++ b/guix-data-service/jobs/load-new-guix-revision.scm @@ -7,6 +7,7 @@ #:use-module (guix inferior) #:use-module (guix profiles) #:use-module (guix derivations) + #:use-module (guix build utils) #:use-module (guix-data-service model package) #:use-module (guix-data-service model guix-revision) #:use-module (guix-data-service model guix-revision-package) @@ -29,17 +30,29 @@ conn packages packages-metadata-ids packages-derivation-ids))) (define (channel->manifest-store-item store channel) - (define (build-and-get-output-path store profile-derv) - (run-with-store store - (mbegin %store-monad - (built-derivations (list profile-derv)) - (return (derivation->output-path profile-derv))))) - - (let ((instances (latest-channel-instances store (list channel)))) - (run-with-store store - (mlet* %store-monad ((manifest (channel-instances->manifest instances)) - (derv (profile-derivation manifest))) - ((store-lift build-and-get-output-path) derv))))) + (let ((inferior (open-inferior + (dirname + (dirname + (which "guix")))))) + (inferior-eval '(use-modules (guix channels) + (guix profiles)) + inferior) + (inferior-eval-with-store + inferior + store + `(lambda (store) + (let ((instances (latest-channel-instances + store + (list (channel (name ',(channel-name channel)) + (url ,(channel-url channel)) + (branch ,(channel-branch channel)) + (commit ,(channel-commit channel))))))) + (run-with-store store + (mlet* %store-monad ((manifest (channel-instances->manifest instances)) + (derv (profile-derivation manifest))) + (mbegin %store-monad + (built-derivations (list derv)) + (return (derivation->output-path derv)))))))))) (define (channel->guix-store-item store channel) (dirname |