[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Self-contained Guix tarball

From: Ludovic Courtès
Subject: Self-contained Guix tarball
Date: Sun, 12 Apr 2015 22:07:03 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Pjotr Prins <address@hidden> skribis:

> Well yes, you need to install all prerequisites and that is not always
> trivial. Try bootstrapping on an old Centos install, for example.
> Can't even get Docker going there.
> It would be nice to have an installable binary tar ball for Guix. Just
> unpack in root and go...

I’ve given that a try since it’s actually quite simple to do.  The
procedure in the attached file produces a self-contained tarball.  It
contains the closure of Guix, as well as /var/guix and an initial
/root/.guix-profile from which one can use the ‘guix’ commands.

I’ve uploaded the result (for x86_64) at:
  SHA1: afde62b3e9f97f9ae0c57eaccfaca842b157cd2f

To install Guix on a foreign distro, follow these steps:

  1. Download the tarball (38 MiB.)

  2. As root, run:
       cd /
       tar xf /path/to/guix-tarball-
     You need lzip and GNU tar.

  3. Setup the daemon as explained in the manual, and run it from

And hopefully, that’s it.

I haven’t actually tried it, so feedback is welcome!  :-)


(use-modules (guix)
             (guix profiles)
             (gnu packages base)
             (gnu packages compression)
             (gnu packages package-management))

(define* (self-contained-tarball #:key (guix guix))
  (mlet %store-monad ((profile (profile-derivation
                                 (list (package->manifest-entry guix))))))
    (gexp->derivation "guix-tarball.tar.lz"
                          (use-modules (guix build store-copy)
                                       (guix build utils)
                                       (gnu build install)
                                       (srfi srfi-26))

                          (define %root
                            (string-append (getcwd) "/root"))
                          (define %root-profile

                          (define (mkdir-p* dir)
                            (mkdir-p (string-append %root "/" dir)))

                          (define (symlink* old new)
                            (symlink old (string-append %root "/" new)))

                          (setenv "PATH"
                                  (string-append #$guix "/sbin:"
                                                 #$tar "/bin:" #$lzip "/bin"))

                          ;; Populate the store.
                          (populate-store '("profile") %root)
                          (for-each (cut register-closure %root <>)

                          ;; 'guix-register' registers profiles as GC roots
                          ;; but the symlink target uses $TMPDIR.  Fix that.
                           (string-append %root
                          (symlink* "/var/guix/profiles"

                          ;; Make root's profile, which makes it a GC root.
                          (mkdir-p* %root-profile)
                          (symlink* #$profile
                                    (string-append %root-profile
                          (symlink* (string-append %root-profile
                                    (string-append %root-profile

                          (mkdir-p* "/root")
                          (symlink* (string-append %root-profile

                          ;; Create the tarball.  Use GNU format so there's no
                          ;; file name length limitation.
                          (chdir %root)
                          (zero? (system* "tar" "--lzip" "--format=gnu"
                                          "-cvf" #$output ".")))
                      #:references-graphs `(("profile" ,profile))
                      #:modules '((guix build utils)
                                  (guix build store-copy)
                                  (gnu build install)))))

;; (pk (with-store store
;;       (run-with-store store (self-contained-tarball))))

Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]