From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#26271: 'guix system' does not support common build option '--root' Date: Tue, 04 Apr 2017 23:34:31 +0200 Message-ID: <87zifvn9g8.fsf@gnu.org> References: <871stjfhfk.fsf@gmail.com> <87y3vrm6zi.fsf@gnu.org> <87inmu3j12.fsf@gmail.com> <87zifwaafz.fsf@garuda.i-did-not-set--mail-host-address--so-tickle-me> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57742) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvW6V-0007Mk-HN for bug-guix@gnu.org; Tue, 04 Apr 2017 17:35:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cvW6Q-0008Bf-IP for bug-guix@gnu.org; Tue, 04 Apr 2017 17:35:07 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:34671) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cvW6Q-0008BT-F3 for bug-guix@gnu.org; Tue, 04 Apr 2017 17:35:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cvW6Q-00035J-8P for bug-guix@gnu.org; Tue, 04 Apr 2017 17:35:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87zifwaafz.fsf@garuda.i-did-not-set--mail-host-address--so-tickle-me> (Chris Marusich's message of "Tue, 04 Apr 2017 00:39:12 -0700") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Chris Marusich Cc: 26271@debbugs.gnu.org Hi Chris, Chris Marusich skribis: > I've attached a small patch series which adds support. Please let me > know what you think. (If you prefer that I send the patches to you via > some other email list or something, please let me know.) I've verified > manually that the patches fix the issue. For example: > > $ GUIX_BUILD_OPTIONS=3D'--root=3Dmy-indirect-root' ./pre-inst-env guix sy= stem disk-image ~/guix/gnu/system/install.scm > /gnu/store/qr83vk7lifm63jscrv1gfqzj80zwkmca-disk-image > $ ls -l | grep indir > lrwxrwxrwx 1 marusich users 54 Apr 3 23:44 my-indirect-root -> /gn= u/store/qr83vk7lifm63jscrv1gfqzj80zwkmca-disk-image > $ ls -l /var/guix/gcroots/auto/ | grep indir > lrwxrwxrwx 1 root root 36 Apr 3 23:44 wk6bx8f7xjq8ab7dz683n64ly21dyw8x -= > /home/marusich/guix/my-indirect-root > > It works the same when I pass the option directly on the command line as > '--root=3Dfoo' or '-r foo', too. Nice. > From ccf03e4bb5d5c2d3a47efdf64e36a7d903bfb2c5 Mon Sep 17 00:00:00 2001 > From: Chris Marusich > Date: Mon, 3 Apr 2017 23:47:22 -0700 > Subject: [PATCH 1/2] build: Export register-root procedure. > > * guix/scripts/build.scm: Export register-root procedure. Applied. > From e96c877459555f4cf868fb5fe4579183f6a773d5 Mon Sep 17 00:00:00 2001 > From: Chris Marusich > Date: Mon, 3 Apr 2017 23:49:22 -0700 > Subject: [PATCH 2/2] system: Support the --root option in 'guix system'. > > Fixes . > > * guix/scripts/system.scm (perform-action): Add parameters 'store' and > 'gc-root'. Update docstring. > (perform-action) [gc-root]: Add an indirect GC root using store. > (%options): Add 'root'. > (process-action): Pass 'store' and 'root' to perform-action. [...] > -(define* (perform-action action os > +(define* (perform-action store action os > #:key grub? dry-run? derivations-only? > use-substitutes? device target > image-size full-boot? > - (mappings '())) [...] > ;; All we had to do was to build SYS. > - (return (derivation->output-path sys)))))))) > + (return (let ((output-path (derivation->output-path sys))) > + (if gc-root > + (register-root store (list output-path) gc-ro= ot) > + output-path))))))))) =E2=80=98perform-action=E2=80=99 is a monadic procedure; IOW, the =E2=80=98= store=E2=80=99 parameter is already threaded into it. Thus, instead of adding an explicit =E2=80=98sto= re=E2=80=99 parameter, which must =E2=80=9Clift=E2=80=9D =E2=80=98register-root=E2=80= =99 in the store monad: (define register-root* (store-lift register-root)) and then use it like a normal monadic procedure: (let ((output (derivation->output-path sys))) (mbegin %store-monad (mwhen gc-root (register-root* (list output) gc-root)) (return output))) Could you change this patch along these lines? Also please make sure to mention =E2=80=98--root=E2=80=99 in =E2=80=98show-= help=E2=80=99 and in guix.texi. Thank you! Ludo=E2=80=99.