2023-10-20 00:44:03 +00:00
# to update:
2023-11-19 23:04:39 +00:00
# - first, figure the rev for `koreader-base`:
# - inside `koreader` repo:
# - `git submodule status base`
# - or `git log base`
2023-10-20 00:44:03 +00:00
# - inside `koreader-base` repo:
2023-11-19 23:04:39 +00:00
# - `git diff old-rev..new-rev thirdparty`
2023-10-20 00:44:03 +00:00
# - update `source.rev` everywhere here that changed upstream
# - zero the hashes here and correct them based on build errors
# - tweak ./vendor-external-projects.patch until it applies
# - usually just upstream changed a URL or something minor
#
# a full rebuild takes approximately 10 minutes on a mid-range desktop
#
# the following build output may look like an error, but is safe to ignore:
# - "awk: fatal: cannot open file `3.9' for reading: No such file or directory"
# - this number comes from the luarocks version
2023-11-19 23:04:39 +00:00
#
# how to automate koreader updates?
# - it may be that koreader-base is more strongly decoupled from `koreader` than first appears:
# - most `koreader` commits which update base simply bump its rev and nothing more.
# - then, `koreader-base` could be its own package, updated independently from the main koreader.
2024-02-03 23:58:41 +00:00
{ lib
, symlinkJoin
, curl
, czmq
, djvulibre
, freetype
, fribidi
, giflib
, glib
, harfbuzz
, k2pdfopt
, leptonica
, libjpeg_turbo
, libpng
, libunibreak
, libwebp
, luajit
, minizip
, mupdf
2024-02-04 02:51:27 +00:00
, mupdf_1_17
2024-02-03 23:58:41 +00:00
, nanosvg
, openssh
2024-02-04 02:51:27 +00:00
, openssl_1_1
, sdcv
2024-02-03 23:58:41 +00:00
, tesseract
, turbo
, utf8proc
2024-02-04 02:51:27 +00:00
, zeromq4
2024-02-03 23:58:41 +00:00
, zstd
, zsync
} :
let
libAndDev = pkg : symlinkJoin {
inherit ( pkg ) name ;
paths = [
( lib . getLib pkg )
( lib . getDev pkg )
] ;
} ;
in
2023-07-19 10:15:07 +00:00
{
2023-07-19 10:44:00 +00:00
thirdparty = {
2024-02-03 23:58:41 +00:00
# providing `package` is just a way to optimize builds, by getting KOReader to use the built nixpkg instead of building it itself from source.
# if it fails during an update, it should always be safe to delete the package key.
2024-02-04 19:39:32 +00:00
# curl = {
# source.url = "https://github.com/curl/curl.git";
# source.rev = "tags/curl-7_80_0";
# source.hash = "sha256-kzozc0Io+1f4UMivSV2IhzJDQXmad4wNhXN/Y2Lsg3Q=";
# package = curl;
# };
# czmq = {
# source.url = "https://github.com/zeromq/czmq.git";
# source.rev = "2a0ddbc4b2dde623220d7f4980ddd60e910cfa78";
# source.hash = "sha256-p4Cl2PLVgRQ0S4qr3VClJXjvAd2LUBU9oRUvOCfVnyw=";
# # package = czmq; # koreader wants v1, nixpkgs has v4
# };
# djvulibre = {
# source.url = "https://gitlab.com/koreader/djvulibre.git";
# source.rev = "6a1e5ba1c9ef81c205a4b270c3f121a1e106f4fc";
# source.hash = "sha256-OWSbxdr93FH3ed0D+NSFWIah7VDTcL3LIGOciY+f4dk=";
# # package = djvulibre; # "cp -fL /build/koreader/base/thirdparty/djvulibre/build/aarch64-unknown-linux-gnu/djvulibre-prefix/src/djvulibre/libdjvu/.libs/libdjvulibre.so.21 ..."
# };
2023-07-19 23:03:57 +00:00
fbink = {
2023-07-20 10:45:44 +00:00
source . url = " h t t p s : / / g i t h u b . c o m / N i L u J e / F B I n k . g i t " ;
2024-03-04 08:19:41 +00:00
source . rev = " 1 a 9 8 9 b 3 0 a 1 9 5 c a 2 4 0 a 3 c f 3 7 f 9 d e 6 1 b 4 b 3 c 7 e 8 9 1 c " ;
source . hash = " s h a 2 5 6 - O 3 b Z z v u j / B R V V + U o u t a a Z Z g G Z w s 2 J / i 5 A r f B H b z 6 o m I = " ;
2024-02-03 23:58:41 +00:00
# package: not packaged for nix
2023-07-19 23:03:57 +00:00
} ;
2024-02-04 19:39:32 +00:00
# freetype2 = {
# source.url = "https://gitlab.com/koreader/freetype2.git";
# source.rev = "VER-2-13-2";
# source.hash = "sha256-yylSmVM3D5xnbFx9qEEHFIP/K0x/WDXZr0MA4C7ng7k=";
# package = libAndDev freetype;
# };
# fribidi = {
# source.url = "https://github.com/fribidi/fribidi.git";
# source.rev = "tags/v1.0.12";
# source.hash = "sha256-L4m/F9rs8fiv9rSf8oy7P6cthhupc6R/lCv30PLiQ4M=";
# package = libAndDev fribidi;
# };
# giflib = {
# source.url = "https://gitlab.com/koreader/giflib.git";
# source.rev = "5.1.4";
# source.hash = "sha256-znbY4tliXHXVLBd8sTKrbglOdCUb7xhcCQsDDWcQfhw=";
# package = giflib;
# };
# glib = {
# source.url = "https://github.com/GNOME/glib.git";
# source.rev = "2.58.3";
# source.hash = "sha256-KmJXCJ6h2QhPyK1axk+Y9+yJzO0wnCczcogopxGShJc=";
# # package = libAndDev glib; # breaks sdcv build
# };
# harfbuzz = {
# source.url = "https://github.com/harfbuzz/harfbuzz.git";
# source.rev = "8.3.0";
# source.hash = "sha256-sO0Kd2wAbMm+Auf7tXsDNal7hqND8iwkb0M/9WWt9sI=";
# # package = harfbuzz;
# package = libAndDev harfbuzz;
# };
2023-07-19 23:49:11 +00:00
kobo-usbms = {
2023-07-20 10:45:44 +00:00
source . url = " h t t p s : / / g i t h u b . c o m / k o r e a d e r / K o b o U S B M S . g i t " ;
2024-03-04 08:19:41 +00:00
source . rev = " v 1 . 3 . 9 " ;
source . hash = " s h a 2 5 6 - / y Y p a g e k W l f T r X u / 1 D N T m B m d d 3 I k C D j R t s l R v 1 3 m t C g = " ;
2024-02-03 23:58:41 +00:00
# package: not in nixpkgs
2023-07-19 23:49:11 +00:00
} ;
2023-07-19 11:12:08 +00:00
leptonica = {
2023-07-20 10:45:44 +00:00
source . url = " h t t p s : / / g i t h u b . c o m / D a n B l o o m b e r g / l e p t o n i c a . g i t " ;
source . rev = " 1 . 7 4 . 1 " ;
source . hash = " s h a 2 5 6 - S D X K a m 7 6 8 x v Z Z v T b X e 3 s s s v Z y e L E E i Y 9 7 V r z x 8 h o c 6 g = " ;
2024-02-03 23:58:41 +00:00
# package = leptonica; # k2pdf needs leptonica src. # cp -f /build/koreader/base/thirdparty/libk2pdfopt/build/aarch64-unknown-linux-gnu/libk2pdfopt-prefix/src/libk2pdfopt/leptonica_mod/dewarp2.c
2023-07-19 11:12:08 +00:00
} ;
2024-02-04 19:39:32 +00:00
# libjpeg-turbo = {
# source.url = "https://github.com/libjpeg-turbo/libjpeg-turbo.git";
# source.rev = "3.0.1";
# source.hash = "sha256-ofdecix4m0FA9gdyQh7zYn99SYBbH2+a7jfoZlsadoA=";
# # package = libAndDev libjpeg_turbo;
# };
2023-07-19 11:12:08 +00:00
libk2pdfopt = {
2023-07-20 10:45:44 +00:00
source . url = " h t t p s : / / g i t h u b . c o m / k o r e a d e r / l i b k 2 p d f o p t . g i t " ;
2024-02-04 02:51:27 +00:00
source . rev = " 0 9 f 1 e 0 1 1 a 6 1 8 c 8 e c 0 6 b 4 c a a 6 7 0 7 9 6 8 2 1 1 9 d 2 a a a 7 " ;
source . hash = " s h a 2 5 6 - 3 7 s Z 4 6 d G 6 Z 1 W k 7 N r h K A K l 5 j 9 r 1 b N 6 g 0 1 c d 5 I y t / 2 c o M = " ;
# package = k2pdfopt; # nixpkgs k2pdfopt does not compile (broken deps). also, uses old insecure mupdf 1.17 (oh well, koreader is even older)
2023-07-19 11:12:08 +00:00
} ;
2024-02-04 19:39:32 +00:00
# libpng = {
# source.url = "https://github.com/glennrp/libpng.git";
# source.rev = "v1.6.40";
# source.hash = "sha256-Rad7Y5Z9PUCipBTQcB7LEP8fIVTG3JsnMeknUkZ/rRg=";
# # package = libAndDev libpng; # "/build/koreader/base/thirdparty/libpng/build/aarch64-unknown-linux-gnu/libpng-prefix/src/libpng-build/.libs/libpng16.so.16"
# };
# libunibreak = {
# source.url = "https://github.com/adah1972/libunibreak.git";
# source.rev = "tags/libunibreak_5_1";
# source.hash = "sha256-hjgT5DCQ6KFXKlxk9LLzxGHz6B71X/3Ot7ipK3KY85A=";
# # package = libAndDev libunibreak; # nixpkgs version is incompatible (kpvcrlib/crengine #includes libunibreak and then fails, calling into undefined functions)
# };
# libwebp = {
# source.url = "https://github.com/webmproject/libwebp.git";
# source.rev = "v1.3.2";
# source.hash = "sha256-gfwUlJ44biO1lB/3SKfMkM/YBiYcz6RqeMOw+0o6Z/Q=";
# package = libAndDev libwebp;
# };
# libzmq = {
# source.url = "https://github.com/zeromq/libzmq";
# source.rev = "883e95b22e0bffffa72312ea1fec76199afbe458";
# source.hash = "sha256-R76EREtHsqcoKxKrgT8gfEf9pIWdLTBXvF9cDvjEf3E=";
# # package = zeromq4; # despite the name, it's libzmq.so.5 instead of libzmq.so.4
# };
2023-07-19 23:49:11 +00:00
lj-wpaclient = {
2023-07-20 10:45:44 +00:00
source . url = " h t t p s : / / g i t h u b . c o m / k o r e a d e r / l j - w p a c l i e n t . g i t " ;
source . rev = " 2 f 9 3 b e b 3 0 7 1 e 6 e b b 5 7 c 7 8 3 b d 5 b 9 2 f 8 3 a a 5 e b b 7 5 7 " ;
source . hash = " s h a 2 5 6 - i l J v i G Z T v L 2 i 1 T N 5 l H Q 4 e A 9 p F i M 7 N l X D + v 9 o f v 5 2 0 b 8 = " ;
2023-07-21 04:20:33 +00:00
machineAgnostic = true ;
2024-02-03 23:58:41 +00:00
# package: not in nixpkgs; not even a non-luajit `wpaclient`
2023-07-19 23:49:11 +00:00
} ;
lodepng = {
2023-07-20 10:45:44 +00:00
source . url = " h t t p s : / / g i t h u b . c o m / l v a n d e v e / l o d e p n g . g i t " ;
2024-03-04 08:19:41 +00:00
source . rev = " d 3 9 8 e 0 f 1 0 d 1 5 2 a 5 d 1 7 f a 3 0 4 6 3 4 7 4 d c 9 f 5 6 5 2 3 f 9 c " ;
source . hash = " s h a 2 5 6 - A p O H U g U 6 X 1 r H w y j A H A / 0 N t + b u D F q Y 2 t t X E n E v d r R l 3 A = " ;
2024-02-03 23:58:41 +00:00
# package: not in nixpkgs, except in source-only form (mujoco.pin.lodepng)
2023-07-19 23:49:11 +00:00
} ;
2024-03-22 02:28:37 +00:00
# lua-htmlparser = {
# source.url = "https://github.com/msva/lua-htmlparser";
# source.rev = "5ce9a775a345cf458c0388d7288e246bb1b82bff";
# source.hash = "sha256-aSTLSfqz/MIDFVRwtBlDNBUhPb7KqOl32/Y62Hdec1s=";
# # package: not in nixpkgs
# };
2024-02-04 19:39:32 +00:00
# luajit = {
# source.url = "https://github.com/LuaJIT/LuaJIT";
# source.rev = "29b0b282f59ac533313199f4f7be79490b7eee51";
# source.hash = "sha256-S57/NR+0hF1KTdn+cbVkJh3MTfklSwtZua1CYKduVlk=";
# # package = luajit; #< could be fixed; follows a different install structure
# };
2024-02-04 20:45:33 +00:00
# lua-rapidjson = {
# source.url = "https://github.com/xpol/lua-rapidjson";
# source.rev = "242b40c8eaceb0cc43bcab88309736461cac1234";
# source.hash = "sha256-y/czEVPtCt4uN1n49Qi7BrgZmkG+SDXlM5D2GvvO2qg=";
# # package: TODO: packaged in nix as a luarocks package
# };
2024-02-04 21:05:36 +00:00
# luasec = {
# source.url = "https://github.com/brunoos/luasec";
# source.rev = "tags/v1.3.1";
# source.hash = "sha256-3iYRNQoVk5HFjDSqRRmg1taSqeT2cHFil36vxjrEofo=";
# # package: TODO: packaged in nix as a luarocks package
# };
# luasocket = {
# source.url = "https://github.com/lunarmodules/luasocket";
# source.rev = "8c2ff7217e2a205eb107a6f48b04ff1b2b3090a1";
# source.hash = "sha256-Y35QYNLznQmErr6rIjxLzw0/6Y7y8TbzD4yaEdgEljA=";
# # package: TODO: packaged in nix as a luarocks package
# };
2024-03-22 02:28:37 +00:00
# lua-Spore = {
# # Complete... ish?
# # this originally failed like so:
# # Missing dependencies for lua-spore 0.3.1-1:
# # luajson >= 1.3 (not installed)
# # it passes now only because we patch out its build-time check for luajson (which we DO provide at runtime)
# source.url = "https://framagit.org/fperrad/lua-Spore";
# source.rev = "tags/0.3.3";
# source.hash = "sha256-wb7ykJsndoq0DazHpfXieUcBBptowYqD/eTTN/EK/6g=";
# # package: not in nixpkgs
# };
2023-07-20 10:45:44 +00:00
lunasvg = {
source . url = " h t t p s : / / g i t h u b . c o m / s a m m y c a g e / l u n a s v g . g i t " ;
source . rev = " 5 9 d 6 f 6 b a 8 3 5 c 1 b 7 c 7 a 0 f 9 d 4 e a 5 4 0 e c 3 9 8 1 7 7 7 8 8 5 " ;
source . hash = " s h a 2 5 6 - g W 2 i k a k S 6 O m z 5 u p m y 2 6 n A o / j k G H Y O 2 k j l B 3 U m K J B h 1 k = " ;
2024-02-03 23:58:41 +00:00
# package: not in nixpkgs
2023-07-20 10:45:44 +00:00
} ;
minizip = {
source . url = " h t t p s : / / g i t h u b . c o m / n m o i n v a z / m i n i z i p " ;
source . rev = " 0 b 4 6 a 2 b 4 c a 3 1 7 b 8 0 b c 5 3 5 9 4 6 8 8 8 8 3 f 7 1 8 8 a c 4 d 0 8 " ;
source . hash = " s h a 2 5 6 - P / 3 M M M G Y D q D 9 N m k Y v w / t h K p U N a 3 w N O S l B B j A N H S o n A g = " ;
2024-02-03 23:58:41 +00:00
# package = libAndDev minizip; # weird #include incompatibilities... maybe resolvable.
2023-07-20 10:45:44 +00:00
} ;
mupdf = {
source . url = " h t t p s : / / g i t h u b . c o m / A r t i f e x S o f t w a r e / m u p d f . g i t " ;
source . rev = " t a g s / 1 . 1 3 . 0 " ;
source . hash = " s h a 2 5 6 - p Q e j R o n 9 f O 9 A 1 m h z 3 o L j B r 1 j 4 H v e D L c Q I W j R 1 / R p y 5 Q = " ;
2024-02-03 23:58:41 +00:00
# package = libAndDev mupdf; # nixpkgs' mupdf is incompatible with koreader's `libwrap-mupdf`
2024-02-04 02:51:27 +00:00
# package = libAndDev mupdf_1_17; # does not compile
2023-07-20 10:45:44 +00:00
} ;
nanosvg = {
source . url = " h t t p s : / / g i t h u b . c o m / m e m o n o n e n / n a n o s v g . g i t " ;
2024-03-04 08:19:41 +00:00
source . rev = " 9 3 c e 8 7 9 d c 4 c 0 4 a 3 e f 1 7 5 8 4 2 8 e c 8 0 0 8 3 c 3 8 6 1 0 b 1 f " ;
source . hash = " s h a 2 5 6 - Z t e n a X J q M Z r 2 + B x Y E N G 1 z U o Q + Q o x l x y 0 m / 1 Y f J B K A F k = " ;
2023-07-21 04:20:33 +00:00
machineAgnostic = true ;
2024-02-03 23:58:41 +00:00
package = nanosvg . src ; # KOReader only wants the .h files, but decides to do that without even building it.
2023-07-20 10:45:44 +00:00
} ;
2024-02-04 19:39:32 +00:00
# openssh = {
# source.url = "https://github.com/openssh/openssh-portable.git";
# source.rev = "V_8_6_P1";
# source.hash = "sha256-yjIpSbe5pt9sEV2MZYGztxejg/aBFfKO8ieRvoLN2KA=";
# package = openssh;
# };
# openssl = {
# source.url = "https://github.com/openssl/openssl.git";
# source.rev = "OpenSSL_1_1_1u";
# source.hash = "sha256-JOcUj4ovA6621+1k2HUsvhGX1B9BjvaMbCaSx680nSs=";
# # TODO: i think we can use nixpkgs openssl, just lift lib/* up to the root of the package directory
# # package = lib.getLib openssl_1_1; # N.B.: requires building with `NIXPKGS_ALLOW_INSECURE=1 nix build --impure ...`
# };
2023-07-20 10:45:44 +00:00
popen-noshell = {
source . url = " h t t p s : / / g i t h u b . c o m / f a m z a h / p o p e n - n o s h e l l . g i t " ;
source . rev = " e 7 1 5 3 9 6 a 4 9 5 1 e e 9 1 c 4 0 a 9 8 d 2 8 2 4 a 1 3 0 f 1 5 8 2 6 8 b b " ;
source . hash = " s h a 2 5 6 - J e B Z M s g 6 Z U G S n y Z 4 e d s 4 w 6 3 g M / L 7 3 E s A n L a H O P p L 6 i M = " ;
2024-02-03 23:58:41 +00:00
# package: not in nixpkgs
2023-07-20 10:45:44 +00:00
} ;
2024-02-04 19:39:32 +00:00
# sdcv = {
# # upstream is (temporarily?) acquiring this via `download_project` machinery
# source.url = "https://github.com/Dushistov/sdcv.git";
# source.rev = "v0.5.5";
# source.hash = "sha256-EyvljVXhOsdxIYOGTzD+T16nvW7/RNx3DuQ2OdhjXJ4=";
# package = sdcv;
# };
2023-07-19 11:12:08 +00:00
tesseract = {
2023-07-20 10:45:44 +00:00
source . url = " h t t p s : / / g i t h u b . c o m / t e s s e r a c t - o c r / t e s s e r a c t . g i t " ;
source . rev = " 6 0 1 7 6 f c 5 a e 5 e 7 f 6 b d e f 6 0 c 9 2 6 a 4 b 5 e a 0 3 d e 2 b f a 7 " ;
source . hash = " s h a 2 5 6 - F Q v l r J + U y 7 + w t U x B u S 5 N d o T o U w N R h Y w 2 j u 8 Y a 8 M L y Q w = " ;
2024-02-03 23:58:41 +00:00
# package = tesseract; # i guess koreader's k2pdf also builds tessearct??
2023-07-20 10:45:44 +00:00
} ;
turbo = {
source . url = " h t t p s : / / g i t h u b . c o m / k e r n e l s a u c e / t u r b o " ;
source . rev = " t a g s / v 2 . 1 . 3 " ;
source . hash = " s h a 2 5 6 - v B R k F d c 5 a 0 F I t 1 5 H B z 3 T n q M Z + G G s q j E e f n f J E p u V T B s = " ;
2024-02-03 23:58:41 +00:00
# package = turbo; # nixpkgs' turbo is a totally different thing
2023-07-20 10:45:44 +00:00
} ;
2024-02-04 19:39:32 +00:00
# utf8proc = {
# source.url = "https://github.com/JuliaStrings/utf8proc.git";
# source.rev = "v2.9.0";
# source.hash = "sha256-Sgh8vTbclUV+lFZdR29PtNUy8F+9L/OAXk647B+l2mg=";
# # package = libAndDev utf8proc; # nixpkgs is v3, not v2; incompatible .so name. /build/koreader/base/thirdparty/utf8proc/build/aarch64-unknown-linux-gnu/utf8proc-prefix/src/utf8proc/libutf8proc.so.2
# };
# zstd = {
# source.url = "https://github.com/facebook/zstd.git";
# source.rev = "tags/v1.5.5";
# source.hash = "sha256-tHHHIsQU7vJySrVhJuMKUSq11MzkmC+Pcsj00uFJdnQ=";
# package = libAndDev zstd;
# };
# zsync2 = {
# source.url = "https://github.com/NiLuJe/zsync2.git";
# source.rev = "e618d18f6a7cbf350cededa17ddfe8f76bdf0b5c";
# source.hash = "sha256-S0vxCON1l6S+NWlnRPfm7R07DVkvkG+6QW5LNvXBlA8=";
# package = zsync; # possibly a different thing than koreader's
# };
2023-07-19 10:44:00 +00:00
} ;
2023-07-19 10:15:07 +00:00
}