guixconfig/library.org
2023-12-01 14:27:53 +01:00

1.3 KiB

Babel Library

This library contains code blocks to be used by other files in this repository.

Converting Lists

Converting org lists into guix use- calls.

  `(,(make-symbol use-call)
    ,@(mapcar (lambda (x)
                (let ((splits (split-string x)))
                  (if (length= splits 1)
                      (make-symbol (car splits))
                    (mapcar (lambda (y) (make-symbol y))
                            splits))))
              entries))

Converting Org lists into Scheme symbol lists.

  `(list
    ,@(mapcar (lambda (x) (make-symbol x)) input))

Converting Tables

  `(list
    ,@(mapcar
       (lambda (row)
         (let ((service-name (cl-first row))
               (configuration (cl-second row)))
           `(,(make-symbol (s-concat service-name "-service-type"))
             (,(make-symbol (s-concat service-name "-configuration"))
              ,@(car (read-from-string configuration))))))
       input))