From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53617) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqitJ-0000XU-7g for guix-patches@gnu.org; Tue, 27 Feb 2018 12:18:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqit9-0001v7-Et for guix-patches@gnu.org; Tue, 27 Feb 2018 12:18:13 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:56198) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eqit9-0001ur-9x for guix-patches@gnu.org; Tue, 27 Feb 2018 12:18:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eqit8-0001cZ-1G for guix-patches@gnu.org; Tue, 27 Feb 2018 12:18:03 -0500 Subject: [bug#30572] [PATCH 6/7] system: Add "guix system docker-image" command. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20180222103528.5108-1-cmmarusich@gmail.com> <20180222103528.5108-6-cmmarusich@gmail.com> <87k1uzr9vt.fsf@garuda.local.i-did-not-set--mail-host-address--so-tickle-me> Date: Tue, 27 Feb 2018 18:17:12 +0100 In-Reply-To: <87k1uzr9vt.fsf@garuda.local.i-did-not-set--mail-host-address--so-tickle-me> (Chris Marusich's message of "Mon, 26 Feb 2018 17:30:46 +0100") Message-ID: <87efl6z71j.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Chris Marusich Cc: 30572@debbugs.gnu.org Chris Marusich skribis: > + (mlet %store-monad ((os-drv (operating-system-derivation os #:containe= r? #t)) Since has a gexp compiler, this line is no longer needed. Instead you can write: #~(do something with #$os) > + (name -> (string-append name ".tar.gz")) > + (system-graph-name -> "system") > + ;; Use a Guile that supports dlopen because it nee= ds to > + ;; dlopen libgcrypt in the initrd. See: > + ;; https://lists.gnu.org/archive/html/guix-devel/2= 017-10/msg00233.html > + (initrd (base-initrd %linux-vm-file-systems > + #:virtio? #t > + #:guile guile-2.2))) Uh, that must be a big initrd indeed. :-) > + (define build > + (with-imported-modules `(,@(source-module-closure '((guix docker) > + (gnu build vm) > + (guix build ut= ils) > + (guix build sy= scalls)) > + #:select? not-co= nfig?) > + ((guix config) =3D> ,config)) > + #~(begin > + ;; Guile-JSON is required by (guix docker). > + (add-to-load-path > + (string-append #+json "/share/guile/site/" > + (effective-version))) > + (use-modules (gnu build vm) > + (guix build utils) > + (guix build syscalls) > + (srfi srfi-26) > + (ice-9 match) > + (guix docker) > + (srfi srfi-19)) > + > + (let* ((inputs > + '#$(append (list tree parted e2fsprogs dosfstools ta= r) > + (map canonical-package > + (list sed grep coreutils findutils g= awk)) > + (if register-closures? (list guix) '()))) > + > + ;; This variable is unused but allows us to add INPUT= S-TO-COPY > + ;; as inputs. > + (to-register '#$os-drv) > + (initialize (root-partition-initializer > + #:closures '(#$system-graph-name) > + #:register-closures? #$register-closures? > + #:system-directory #$os-drv > + ;; De-duplication would fail due to > + ;; cross-device link errors, so don't do= it. > + #:deduplicate? #f)) > + (root "/tmp/root")) > + > + (set-path-environment-variable "PATH" '("bin" "sbin") inpu= ts) > + (mkdir-p root) > + (initialize root) > + ;; Use a temporary directory inside xchg to avoid hitting = space > + ;; limitations in the initrd's root file system. > + (let ((tmpdir "/xchg/tmp/docker-image")) > + (build-docker-image > + (string-append "/xchg/" #$name) ;; The output file. > + #$os-drv > + #:closure (string-append "/xchg/" #$system-graph-name) > + #:compressor '(#+(file-append gzip "/bin/gzip") "-9n") > + #:creation-time (make-time time-utc 0 1) > + #:tmpdir tmpdir > + #:extra-items-dir root)))))) > + (expression->derivation-in-linux-vm > + name > + build What about here replacing =E2=80=98build=E2=80=99 on the line above with so= mething like: #~(execl #$(program-file "build-docker-image.scm" build) "build-docker-image") This would create a =E2=80=98build-docker-image.scm=E2=80=99 script that us= es the real Guile 2.2, but we could still use guile-static-stripped in the initrd. WDYT? Thanks! Ludo=E2=80=99.