From: Mike <mike@swierczek.io>
To: guix-devel@gnu.org
Subject: Re: What is wrong with these few lines of guile code?
Date: Tue, 31 Oct 2017 10:02:28 -0400 [thread overview]
Message-ID: <dd07b3e6-44ee-a48f-6d3c-5286a0fa9829@swierczek.io> (raw)
In-Reply-To: <a11d7a2e-35ff-1333-9238-c332c6d8d163@crazy-compilers.com>
On 10/31/2017 09:41 AM, Hartmut Goebel wrote:
> Hallo,
>
> i replaced the code of gnu/system/install.scm(make-cow-store target) [1]
> with the code below. Now when running this code (which is triggered by
> "herd start cow-store /mnt" in the installation-os)|I get this error:
> |
>
> herd: exception caught while executing 'start' on service 'cow-store':
> ERROR: Unbound variable: gexp
>
> What is wrong with this code? (Parentheses are matching, of course :-)
I'm a Scheme novice, but is your use of 'target' instead of '#$target'
further down the definition body a problem? Or is that a proper use of
Guile macros?
-Mike
> [1]
> https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/system/install.scm#n70
>
> (define (make-cow-store target)
> "Return a gexp that makes the store copy-on-write, using TARGET as the
> backing store. This is useful when TARGET is on a hard disk, whereas the
> current store is on a RAM disk."
>
> (define (set-store-permissions directory)
> ;; Set the right perms on DIRECTORY to use it as the store.
> #~(begin
> (chown #$directory 0 30000) ;use the fixed
> 'guixbuild' GID
> (chmod #$directory #o1775)))
>
> #~(begin
> ;; Bind-mount TARGET's /tmp in case we need space to build things.
> (let ((tmpdir (string-append #$target "/tmp")))
> (mkdir-p tmpdir)
> (mount tmpdir "/tmp" "none" MS_BIND))
>
> (let* ((rw-dir (string-append target #$%backing-directory))
> ;; FIXME: calculate work-dir from backing-directory:
> ;; normpath(backing-directory + "../.overlayfs-workdir")
> (work-dir (string-append target "/tmp/.overlayfs-workdir")))
> (mkdir-p rw-dir)
> (mkdir-p work-dir)
> (mkdir-p "/.rw-store")
> #$(set-store-permissions #~rw-dir)
> #$(set-store-permissions "/.rw-store")
>
> ;; Mount the overlay, then atomically make it the store.
> (mount "none" "/.rw-store" "overlay"
> (string-append "lowerdir=" #$(%store-prefix)
> "upperdir=" #~rw-dir ","
> "workdir=" #~work-dir))
> (mount "/.rw-store" #$(%store-prefix) "" MS_MOVE)
> (rmdir "/.rw-store"))))
>
next prev parent reply other threads:[~2017-10-31 14:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-31 13:41 What is wrong with these few lines of guile code? Hartmut Goebel
2017-10-31 14:02 ` Mike [this message]
2017-10-31 17:50 ` Christopher Baines
2017-11-03 14:34 ` Hartmut Goebel
2017-11-03 16:09 ` Ricardo Wurmus
2017-11-04 11:46 ` Pjotr Prins
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dd07b3e6-44ee-a48f-6d3c-5286a0fa9829@swierczek.io \
--to=mike@swierczek.io \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).