[Top][All Lists]

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

Re: Newbie: Define package that downloads multiple files from an open di

From: Simon Tournier
Subject: Re: Newbie: Define package that downloads multiple files from an open directory
Date: Fri, 26 May 2023 12:14:11 +0200


On ven., 26 mai 2023 at 05:22, Rodrigo Morales <> 

>   | (define-public my-package-1
>   |   (package
>   |    (name "my-package-1")
>   |    (version "1.0")
>   |    (home-page "My home-page")
>   |    (synopsis "My synopsis")
>   |    (description "My description")
>   |    (license gpl3+)
>   |    (source
>   |     (origin
>   |      (method url-fetch)
>   |      (uri 
> "";)
>   |      (sha256
>   |       (base32
>   |        "10sfm4648v1ywki639jsl5darkcil1is462w0v65xxr75k4l1ywl"))))
>   |    (build-system copy-build-system)
>   |    (arguments
>   |     '(#:install-plan
>   |       '(("blindtext.dtx" "share/"))))))
>   `----


>   Let's suppose I want to define a single Guix package that downloads
>   the files `blindtext.dtx' and `blindtext.ins' (that is, two files
>   instead of one) and makes them available at
>   `~/.guix-profile/share'. What would the package definition look like?

You could add an ’inputs’ that is an ’origin’ with the file you want.
Something like:

--8<---------------cut here---------------start------------->8---
       '(("blindtext.dtx" "share/"))
       (modify-phases %standard-phases
         (add-after 'unpack 'add-ins
           (lambda* (#:key outputs inputs #:allow-other-keys)
             (let ((out (string-append (assoc-ref outputs "out") "/share/")))
               (mkdir-p out)
               (copy-file (assoc-ref inputs "ins")
                          (string-append out "/blindtext.ins"))))))))
     `(("ins" ,(origin
                 (method url-fetch)
--8<---------------cut here---------------end--------------->8---

and then,

 --8<---------------cut here---------------start------------->8---
$ tree $(guix build -L /tmp/pkg my-package-1)
└── share
    ├── blindtext.dtx
    └── blindtext.ins

2 directories, 2 files
--8<---------------cut here---------------end--------------->8---

However, since it looks like TeXLive packages, you might be interested
by ’simple-texlive-package’ from (gnu packages tex).

--8<---------------cut here---------------start------------->8---
(define* (simple-texlive-package name locations hash
                                 #:key trivial?)
  "Return a template for a simple TeX Live package with the given NAME,
downloading from a list of LOCATIONS in the TeX Live repository, and expecting
the provided output HASH.  If TRIVIAL? is provided, all files will simply be
copied to their outputs; otherwise the TEXLIVE-BUILD-SYSTEM is used."
--8<---------------cut here---------------end--------------->8---

Well, this procedure is not exported and it’s probably not exactly what
you want.

Hope that helps,

reply via email to

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