[Top][All Lists]

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

Reconstructing pandoc share/ path from arch, os, compilerName (and versi

From: Wiktor Żelazny
Subject: Reconstructing pandoc share/ path from arch, os, compilerName (and versions) in a package definition with copy-build-system
Date: Fri, 16 Sep 2022 15:21:34 +0200

(and versions) in a package definition with copy-build-system
X-PGP-Fingerprint: BDC9 74CD D9C9 BA7D 761A  573D C735 A8C6 AB60 79D5

Hi Guix,

I’m trying to package pandoc-letter [1], which provides a letter
template for Pandoc. The working idea has been to use copy-build-system
and copy template-letter.tex, which is in the pandoc-letter repository
(there are no tarballs), to the directory where Pandoc keeps its default

For a start, I adapted some code from gnu/packages/vim.scm where an
analogous approach is common for Vim plugins:

   (define-public pandoc-letter
     (let ((commit "b0fd7342b352ebb87aea17614ec014f68d48747f")
           (revision "1"))
         (name "pandoc-letter")
         (version (string-append "0.0.0-" revision "."
                                 (string-take commit 7)))
         (source (origin
                   (method git-fetch)
                   (uri (git-reference
                         (url "";)
                         (commit commit)))
                   (file-name (string-append name "-" version "-checkout"))
         (build-system copy-build-system)
          '(#:install-plan '(("template-letter.tex"
         (synopsis "Simple letter template for Pandoc")
          "This template allows you to write letters in Markdown and convert 
them to
   nice looking PDFs using Pandoc and LaTeX.  It accepts arguments used in the
   LaTeX letter class, all of which can be specified in a YAML metadata block.
   Additional Pandoc/LaTeX options can be configured directly in the metadata
         (home-page "";)
         (license license:gpl3))))

This builds, but the actual templates directory is not
share/pandoc/data/templates, but something more dynamic. For example, on
my machine it is

Apparently, this path is constructed in Paths_pandoc.hs file, with its
contents defined in the pandoc Guix package. The relevant snippet is

   datadir :: FilePath
   datadir = \"~a/share/\" ++
     arch ++ \"-\" ++
     os ++ \"-\" ++
     compilerName ++ \"-~a/pandoc-~a\"

I don’t know what the motivation for this is. Anyway, I decided to try
to reconstruct the target path, starting from the Pandoc version string
(hidden in this ~a? well, whatever). The definition of the blender
package in Guix gave me some inspiration:

        (let ((ghc-pandoc-version (version-major+minor (package-version 
         '(#:install-plan '(("template-letter.tex"
                             (string-append "share/pandoc-"

While building this, I got the error with the suggestion to load the
(gnu packages haskell-xyz) module, which was promising. Unfortunately,
after fixing that, I’m getting

   ice-9/boot-9.scm:1685:16: In procedure raise-exception:
   In procedure string-append: Wrong type (expecting string): (string-append 
"share/pandoc-" ghc-pandoc-version "/data/templates/")

Normally, I would inspect the type and value of ghc-pandoc-version at
this point via “print debugging”, but I have no idea how to do that in
Guile in the context of package definition development.

If you could help me to get unstuck, I would be grateful. Or, maybe you
can suggest a wholly different approach, superior to my
path-reconstruction idea.


Have a nice weekend,


Attachment: signature.asc
Description: PGP signature

reply via email to

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