unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Richard Sent <richard@freakingpenguin.com>
To: help-guix@gnu.org
Subject: Cuirass custom jobs module syntax?
Date: Fri, 01 Mar 2024 13:25:56 -0500	[thread overview]
Message-ID: <87a5nh24i3.fsf@freakingpenguin.com> (raw)

Hi all,

I'm trying to build operating-system declarations as part of a LAN
substitute server, but I can't seem to get Cuirass's custom build type
working.

My Cuirass specification looks like this:

--8<---------------cut here---------------start------------->8---
(define %rsent-cuirass-specs
  #~(list (specification
           (name "rsent-systems")
           ;; TODO: Find out option here to build operating-systems
           ;; (not images) in rsent channel.
           (build '(custom (rsent machines lan gibraltar)))
           (channels
            (cons #$rsent-channel-gexp
                  %default-channels)))))
--8<---------------cut here---------------end--------------->8---

gibraltar has code that looks like

--8<---------------cut here---------------start------------->8---
(define-module (rsent machines lan gibraltar)
;; ...
  #:export (cuirass-jobs))

(define* (gibraltar-jobs store systems #:key source commit)
  (map (lambda (system)
         (let ((name (string->symbol
                      (string-append "gibraltar." system))))
           (deriviation->job name
                             (operating-system-derivation
                              gibraltar-system))))))

(define (cuirass-jobs store arguments)
  "Register Cuirass jobs."
  (define systems
    (arguments->systems arguments))
  
  ;; Turn off grafts.  Grafting is meant to happen on the user's machines.
  (parameterize ((%graft? #f))
    (gibraltar-jobs store systems)))
--8<---------------cut here---------------end--------------->8---

When Cuirass evaluates the specification, this error is printed in the
logs:

--8<---------------cut here---------------start------------->8---
;; building path(s) `/gnu/store/9rpjz153hxfknlmywyipxcz5yaiag8nw-profile'
;; In thread:
;; uncaught throw to %exception: (#<&inferior-exception arguments: (wrong-type-arg "symbol->string" "Wrong type argument in position ~A (expecting ~A): ~S" (1 "symbol" (rsent machines lan gibraltar)) ((rsent machines lan gibraltar)))
;; inferior: #<inferior pipe (0 1 1) 7fc6d310a380>
;; stack: ((#f ("ice-9/boot-9.scm" 1779 13))
;;        (raise-exception ("ice-9/boot-9.scm" 1682 16))
;;        (raise-exception ("ice-9/boot-9.scm" 1684 16))
;;        (symbol->string (#f #f #f))
;;        (try-module-autoload ("ice-9/boot-9.scm" 3526 15))
;;        (#f ("ice-9/boot-9.scm" 3252 13))
;;        (#f ("ice-9/threads.scm" 389 8))
;;        (resolve-interface ("ice-9/boot-9.scm" 3326 17))
;;        (#f ("gnu/ci.scm" 559 27))
;;        (map1 ("srfi/srfi-1.scm" 585 17))
;;        (append-map ("srfi/srfi-1.scm" 672 15))
;;        (map1 ("srfi/srfi-1.scm" 585 17))
;;        (append-map ("srfi/srfi-1.scm" 672 15))
;;        (cuirass-jobs ("gnu/ci.scm" 499 4))
;;        (#f ("ice-9/eval.scm" 158 9))
;;        (with-exception-handler ("ice-9/boot-9.scm" 1751 10))
;;        (call-with-prompt ("ice-9/boot-9.scm" 723 2))
;;        (#f (#f #f #f))
;;        (#f ("guix/repl.scm" 98 21))
;;        (with-exception-handler ("ice-9/boot-9.scm" 1751 10))
;;        (with-exception-handler ("ice-9/boot-9.scm" 1746 15))
;;        (#f ("guix/repl.scm" 125 7)))>)
--8<---------------cut here---------------end--------------->8---

I assume it's angry that my list of symbols isn't a symbol, ergo it
can't convert it into a string. However, if I take the code from
guix/ci.scm:555 and run it, the module does resolve successfully.

--8<---------------cut here---------------start------------->8---
;; This runs just fine. Code taken from cuirass-jobs in guix/ci.scm:555
(use-modules
 (srfi srfi-1)
 (ice-9 match))

(let ((subset '(custom (rsent machines lan gibraltar))))
    (match subset
      (('custom . modules)
          ;; Build custom modules jobs only.
          (append-map
           (lambda (module)
             (let ((proc (module-ref
                          (resolve-interface module)
                          'cuirass-jobs)))
               proc ;no store for testing, just return proc if found
               ))
           modules))))
--8<---------------cut here---------------end--------------->8---

Why would (resolve-interface) work with (rsent machines lan gibraltar)
in one setting but not in another? Running Guix pull locally with the
same channel list works just fine, although the hash of the output
profile is different for reasons I don't understand.

Just for funsies I did try double quoting, e.g. '(custom '(rsent
machines lan gibraltar)), but that didn't help.

Appreciate any help or examples on this!

-- 
Take it easy,
Richard Sent
Making my computer weirder one commit at a time.


                 reply	other threads:[~2024-03-01 18:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=87a5nh24i3.fsf@freakingpenguin.com \
    --to=richard@freakingpenguin.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).