unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Alex ter Weele <alex.ter.weele@gmail.com>
To: help-guix@gnu.org
Subject: How can I use ()
Date: Sat, 13 Jan 2018 08:32:48 -0600	[thread overview]
Message-ID: <87h8rp25in.fsf@librem.i-did-not-set--mail-host-address--so-tickle-me> (raw)

(Following this conversion on #guix:
https://gnunet.org/bot/log/guix/2018-01-10#T1600427)

I am trying to use the mcron service to run backups. I have written:

(define (backup-home user)
  #~(begin
      (execl
       (string-append #$borg "/bin/borg")
       "create"
       "--stats" "--list" "--verbose"
       "/mnt/borg::{hostname}-{utcnow}"
       (format "/home/%s" #$user))
      ;; TODO: borg prune.
      ))

(define (backup-home-job user)
  #~(job '(next-hour '(18))
         #$(backup-home user)
         #:user #$user))

I would like to run the gexp (backup-home "alex") from the REPL so that
I can verify it works properly. I looked into what the mcron service
itself does with the gexp in order to run it and found that (gnu
shepherd)'s shepherd-configuration-file uses gexp->file.

Based on this, what I think I want to do is something like:

,enter-store-monad
(build (list (gexp->script "test" (backup-home "alex"))))

And then run the resulting script file. However, doing such gives the
error:

ERROR: In procedure string->utf8:
ERROR: In procedure string->utf8: Wrong type argument in position 1 (expecting string): #<procedure 327b030 at guix/gexp.scm:1128:2 (state)>

At this point I tried putting a string in what I think is the right
place, once again running in the store monad REPL:

(build "foo" (list (gexp->script "test" (backup-home "alex"))))

But this gives:

ERROR: In procedure length:
ERROR: In procedure length: Wrong type argument in position 1: "foo"

At which point I'm stumped. I'd love to know what I'm doing wrong!

Thanks,
Alex

             reply	other threads:[~2018-01-13 22:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-13 14:32 Alex ter Weele [this message]
2018-01-14 21:27 ` How can I use (guix store)’s build (was “Re: How can I use ()”) Alex ter Weele
2018-01-16 16:11 ` How can I use () Ludovic Courtès

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=87h8rp25in.fsf@librem.i-did-not-set--mail-host-address--so-tickle-me \
    --to=alex.ter.weele@gmail.com \
    --cc=help-guix@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.
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).