[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How can I use ()

From: Alex ter Weele
Subject: How can I use ()
Date: Sat, 13 Jan 2018 08:32:48 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

(Following this conversion on #guix:

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

(define (backup-home user)
       (string-append #$borg "/bin/borg")
       "--stats" "--list" "--verbose"
       (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:

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

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

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!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]