aboutsummaryrefslogtreecommitdiff
path: root/gnu/system/install.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-04-14 23:19:01 +0200
committerLudovic Courtès <ludo@gnu.org>2015-04-14 23:20:26 +0200
commit9d3fb6c767913746340e8af4d967e386d2d0f1fd (patch)
tree14f400ae0da25a359c04d509faec91f21390fe18 /gnu/system/install.scm
parenta84e523c4a470de06ca60478d5ac32289b444b03 (diff)
downloadguix-9d3fb6c767913746340e8af4d967e386d2d0f1fd.tar
guix-9d3fb6c767913746340e8af4d967e386d2d0f1fd.tar.gz
install: Add a procedure to build a self-contained binary tarball.
Suggested by Pjotr Prins <pjotr.public12@thebird.nl> at <http://lists.gnu.org/archive/html/guix-devel/2015-04/msg00229.html>. * gnu/build/install.scm (populate-single-profile-directory): New procedure. * gnu/system/install.scm (self-contained-tarball): New procedure. * Makefile.am (guix-binary.%.tar.xz): New target.
Diffstat (limited to 'gnu/system/install.scm')
-rw-r--r--gnu/system/install.scm39
1 files changed, 38 insertions, 1 deletions
diff --git a/gnu/system/install.scm b/gnu/system/install.scm
index 2e7e4eafad..2fd35e8c48 100644
--- a/gnu/system/install.scm
+++ b/gnu/system/install.scm
@@ -22,6 +22,7 @@
#:use-module (guix store)
#:use-module (guix monads)
#:use-module ((guix store) #:select (%store-prefix))
+ #:use-module (guix profiles)
#:use-module (gnu packages admin)
#:use-module (gnu packages linux)
#:use-module (gnu packages cryptsetup)
@@ -30,7 +31,8 @@
#:use-module (gnu packages grub)
#:use-module (gnu packages texinfo)
#:use-module (gnu packages compression)
- #:export (installation-os))
+ #:export (self-contained-tarball
+ installation-os))
;;; Commentary:
;;;
@@ -39,6 +41,41 @@
;;;
;;; Code:
+
+(define* (self-contained-tarball #:key (guix guix))
+ "Return a self-contained tarball containing a store initialized with the
+closure of GUIX. The tarball contains /gnu/store, /var/guix, and a profile
+under /root/.guix-profile where GUIX is installed."
+ (mlet %store-monad ((profile (profile-derivation
+ (manifest
+ (list (package->manifest-entry guix))))))
+ (define build
+ #~(begin
+ (use-modules (guix build utils)
+ (gnu build install))
+
+ (define %root "root")
+
+ (setenv "PATH"
+ (string-append #$guix "/sbin:" #$tar "/bin:" #$xz "/bin"))
+
+ (populate-single-profile-directory %root
+ #:profile #$profile
+ #:closure "profile")
+
+ ;; Create the tarball. Use GNU format so there's no file name
+ ;; length limitation.
+ (with-directory-excursion %root
+ (zero? (system* "tar" "--xz" "--format=gnu"
+ "-cvf" #$output ".")))))
+
+ (gexp->derivation "guix-tarball.tar.xz" build
+ #:references-graphs `(("profile" ,profile))
+ #:modules '((guix build utils)
+ (guix build store-copy)
+ (gnu build install)))))
+
+
(define (log-to-info)
"Return a script that spawns the Info reader on the right section of the
manual."