unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob 49b7accb528e8cc16cf264e6da14749bc003b554 3753 bytes (raw)
name: gnu/packages/zim-files.scm 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
 
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages zim-files)
  #:use-module (gnu packages)
  #:use-module (guix build-system copy)
  #:use-module (guix download)
  #:use-module (guix gexp)
  #:use-module (guix utils)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages))

;;; Commentary:
;;;
;;; Many Guix contributors have a tendency to update packages in this
;;; way: they only update the package revision and then launch a build
;;; that fails just to make Guix tell them the right base32 hash. They
;;; then update the base32 hash and launch the build again.
;;;
;;; However some ZIM files are quite big. At the time of writing,
;;; wikipedia_en_all_maxi_2022-05.zim is about 89 GiB.
;;;
;;; So this approach will be time consuming as the second time Guix
;;; will restart downloading the same file from scratch.
;;;
;;; The solution to this issue is to download the sha256sums (for that
;;; simply append .sha256 to the URL of the ZIM file). It will give a
;;; file like that:
;;; f12163513307893c87fd75009b1d61677bae675627eaadf4cb0fa63953eea021  wikipedia_en_all_maxi_2022-05.zim
;;;
;;; You can then use this hash to compute the base32 with nix-hash:
;;; $ nix-hash --type sha256 --to-base32 \
;;; f12163513307893c87fd75009b1d61677bae675627eaadf4cb0fa63953eea021
;;; 08d0xr9kk9hgrgsavsi7arkswyv7c4frn03mzn3kr2876d8n68gi

(define-public wikipedia-en-all-maxi
  (package
    (name "wikipedia-en-all-maxi")
    (version "2022-05")
    (source (origin
              (method url-fetch)
              (uri (string-append
                    "https://mirror.download.kiwix.org/zim/wikipedia/"
                    (string-replace-substring name "-" "_")
                    "_" version ".zim"))
              (sha256
               (base32
                "08d0xr9kk9hgrgsavsi7arkswyv7c4frn03mzn3kr2876d8n68gi"))))
    (build-system copy-build-system)
    (arguments
     (list
      ;; We are not (yet) generating the zim file, so it doesn't make sense to
      ;; build substitutes.
      #:substitutable? #f
      ;; If we use kiwix-serve, the path of the ZIM file needs to be passed to
      ;; it. And if the filename has a version in it, we'd need to update the
      ;; path manually each time the package is updated. We also need to
      ;; change the filename to match the package name.
      #:install-plan #~'((#$(string-append
                             (string-replace-substring name "-" "_")
                             "_" version ".zim")
                          #$(string-append "share/" name ".zim")))))
    (synopsis
     "Complete English Wikipedia packed in a ZIM file, for offline usage with
Kiwix")
    (description
     "Wikipedia is a free Encyclopedia.  This is the English version.  It
contains all the articles, and all the medias (images, etc) present in
the articles in a scaled down resolution.")
    (home-page "https://en.wikipedia.org/wiki/Main_Page")
    (license license:cc-by-sa3.0)))

debug log:

solving 49b7accb52 ...
found 49b7accb52 in https://yhetil.org/guix-patches/20221223222024.13805-2-GNUtoo@cyberdimension.org/

applying [1/1] https://yhetil.org/guix-patches/20221223222024.13805-2-GNUtoo@cyberdimension.org/
diff --git a/gnu/packages/zim-files.scm b/gnu/packages/zim-files.scm
new file mode 100644
index 0000000000..49b7accb52

Checking patch gnu/packages/zim-files.scm...
Applied patch gnu/packages/zim-files.scm cleanly.

index at:
100644 49b7accb528e8cc16cf264e6da14749bc003b554	gnu/packages/zim-files.scm

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).