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
|
{ depot, pkgs, lib, ... }:
let
goDeps = import ../go-deps.nix { inherit depot pkgs; };
# German first: the course readings this is for are mostly German, and
# quote French and English.
tesseract = pkgs.tesseract.override { enableLanguages = [ "deu" "eng" "fra" ]; };
unwrapped = depot.nix.buildGo.program {
name = "epubify";
srcs = [
./main.go
./db.go
./pdf.go
./jev.go
./gemini.go
./classify.go
./ocr.go
./align.go
./decide.go
./pages.go
./epub.go
./report.go
./sorting.go
./calibre.go
];
embeds = [ ./epub.css ];
deps = [
goDeps.modernc-sqlite
goDeps.modernc-libc
goDeps.modernc-libc.sys.types
goDeps.golang-x-sys-unix
];
};
in
pkgs.runCommand "epubify"
{
nativeBuildInputs = [ pkgs.makeWrapper ];
outputs = [ "out" "man" ];
meta.description = "Turn a scanned book chapter into an EPUB with the printed page numbers";
} ''
mkdir -p $out/bin $man/share/man/man1
makeWrapper ${unwrapped}/bin/epubify $out/bin/epubify \
--prefix PATH : ${lib.makeBinPath [ pkgs.poppler-utils tesseract ]}
cp ${./epubify.1} $man/share/man/man1/epubify.1
''
|