From 83832a78627c3c4511a8d6595f855628124d1b41 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 23 Feb 2019 20:15:35 +0000 Subject: [PATCH] Build new Guix revisions within an inferior Once inferiors can provide some isolation, this will make building guix in this way safer. --- .../jobs/load-new-guix-revision.scm | 35 +++++++++++++------ 1 file 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