From: Simon Tournier <[email-masked]>
Date: Thu, 19 Oct 2023 11:36:11 +0200

Hi,

Trying to answer to this message [1], I notice something unexpected for
me.  I read from the manual:

--8<---------------cut here---------------start------------->8---
-- Procedure: url-fetch url hash-algo hash [name] [#:executable? #f]
     Return a fixed-output derivation that fetches data from URL (a
     string, or a list of strings denoting alternate URLs), which is
     expected to have hash HASH of type HASH-ALGO (a symbol).  By
     default, the file name is the base name of URL; optionally, NAME
     can specify a different file name.  When EXECUTABLE? is true, make
     the downloaded file executable.

     When one of the URL starts with ‘mirror://’, then its host part is
     interpreted as the name of a mirror scheme, taken from
     ‘%mirror-file’.

     Alternatively, when URL starts with ‘file://’, return the
     corresponding file name in the store.
--8<---------------cut here---------------end--------------->8---

Therefore, I do:

--8<---------------cut here---------------start------------->8---
(define-module (pkg)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (gnu packages pdf)
  #:use-module (gnu packages gnome))

(define-public zathura-custom
  (package
   (inherit zathura)
   (name "zathura-custom")
   (version "4.0")
   (source
    (origin
     (method url-fetch)
     (uri
      ;"https://pwmt.org/projects/zathura/download/zathura-0.5.2.tar.xz"
      "file:///tmp/zathura-custom/zathura-mine.tar.xz"
      )
     (sha256
      (base32
       "0000000000000000000000000000000000000000000000000000"))))))
--8<---------------cut here---------------end--------------->8---

And then:

--8<---------------cut here---------------start------------->8---
$ guix build -L /tmp/zathura-custom zathura-custom -S -d
Backtrace:
          12 (primitive-load "/home/simon/.config/guix/current/bin/guix")
In guix/ui.scm:
   2323:7 11 (run-guix . _)
  2286:10 10 (run-guix-command _ . _)
In ice-9/boot-9.scm:
  1752:10  9 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
In guix/status.scm:
    839:4  8 (call-with-status-report _ _)
In ice-9/boot-9.scm:
  1752:10  7 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
In guix/store.scm:
   659:37  6 (thunk)
   1298:8  5 (call-with-build-handler #<procedure 7f31d1cb85d0 at guix/ui.scm:1219:2 (continue store things mode)> _)
In guix/scripts/build.scm:
   797:43  4 (_)
In srfi/srfi-1.scm:
   586:17  3 (map1 ("/gnu/store/mkx0xbh68sihhqxdwbjcdi1njdqra7cq-zathura-mine.tar.xz"))
In guix/derivations.scm:
    136:0  2 (%derivation-file-name-procedure "/gnu/store/mkx0xbh68sihhqxdwbjcdi1njdqra7cq-zathura-mine.tar.xz")
In ice-9/boot-9.scm:
  1685:16  1 (raise-exception _ #:continuable? _)
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure struct-vtable: Wrong type argument in position 1 (expecting struct): "/gnu/store/mkx0xbh68sihhqxdwbjcdi1njdqra7cq-zathura-mine.tar.xz"
--8<---------------cut here---------------end--------------->8---

Note:

    $ guix hash /tmp/zathura-custom/zathura-mine.tar.xz
    15314m9chmh5jkrd9vk2h2gwcwkcffv2kjcxkd4v3wmckz5sfjy6

    $ guix download https://pwmt.org/projects/zathura/download/zathura-0.5.2.tar.xz
    Starting download of /tmp/guix-file.d3GzTC
[...]
    15314m9chmh5jkrd9vk2h2gwcwkcffv2kjcxkd4v3wmckz5sfjy6

Cheers,
simon

1: [TIL] guix doesn't check hash when uri starts with file:///
Rodrigo Morales <[email-masked]>
Wed, 20 Sep 2023 19:18:57 +0000
id:[email-masked]
https://lists.gnu.org/archive/html/help-guix/2023-09
https://yhetil.org/guix/[email-masked]