(and versions) in a package definition with copy-build-system Reply-To: X-PGP-Key: https://freeshell.de/~wz/pubkey.asc 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 templates. 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")) (package (name "pandoc-letter") (version (string-append "0.0.0-" revision "." (string-take commit 7))) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/aaronwolen/pandoc-letter") (commit commit))) (file-name (string-append name "-" version "-checkout")) (sha256 (base32 "1868vs95l0alprvbhwjc60xik2rd7zbpdcysbp2ci81gqffx6r78")))) (build-system copy-build-system) (arguments '(#:install-plan '(("template-letter.tex" "share/pandoc/data/templates/")))) (synopsis "Simple letter template for Pandoc") (description "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 block.") (home-page "https://github.com/aaronwolen/pandoc-letter") (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 share/x86_64-linux-ghc-8.10.7/pandoc-2.14.0.3/data/templates. 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: (arguments (let ((ghc-pandoc-version (version-major+minor (package-version ghc-pandoc)))) '(#:install-plan '(("template-letter.tex" (string-append "share/pandoc-" ghc-pandoc-version "/data/templates/")))))) 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. [1]: https://github.com/aaronwolen/pandoc-letter Have a nice weekend, WŻ