[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#26271: 'guix system' does not support common build option '--root'
From: |
Ludovic Courtès |
Subject: |
bug#26271: 'guix system' does not support common build option '--root' |
Date: |
Tue, 04 Apr 2017 23:34:31 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) |
Hi Chris,
Chris Marusich <address@hidden> 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='--root=my-indirect-root' ./pre-inst-env guix system
> 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 ->
> /gnu/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=foo' or '-r foo', too.
Nice.
> From ccf03e4bb5d5c2d3a47efdf64e36a7d903bfb2c5 Mon Sep 17 00:00:00 2001
> From: Chris Marusich <address@hidden>
> 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 <address@hidden>
> Date: Mon, 3 Apr 2017 23:49:22 -0700
> Subject: [PATCH 2/2] system: Support the --root option in 'guix system'.
>
> Fixes <https://bugs.gnu.org/26271>.
>
> * 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-root)
> + output-path)))))))))
‘perform-action’ is a monadic procedure; IOW, the ‘store’ parameter is
already threaded into it. Thus, instead of adding an explicit ‘store’
parameter, which must “lift” ‘register-root’ 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 ‘--root’ in ‘show-help’ and in
guix.texi.
Thank you!
Ludo’.