-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
flake.nix
163 lines (157 loc) · 5.3 KB
/
flake.nix
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
{
description = "Nix related tooling for a command line interface for audible. With the CLI you can download your Audible books, cover, chapter files & conver them.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/x86_64-linux";
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
nix-filter.url = "github:numtide/nix-filter";
devshell.url = "github:numtide/devshell";
};
outputs = {
self,
nixpkgs,
systems,
...
} @ inputs: let
eachSystem = nixpkgs.lib.genAttrs (import systems);
pkgsFor = eachSystem (system: (nixpkgs.legacyPackages.${system}.extend inputs.devshell.overlays.default));
tex-deps-builder = texlive-pkg: (texlive-pkg.combine {
inherit
(texlive-pkg)
scheme-small
beamer
latex-bin
latexmk
silence
appendixnumberbeamer
fira
fontaxes
mwe
noto
csquotes
fontspec
infwarerr
kvoptions
# only for demo
biblatex
biber
# only for language examples
haranoaji
haranoaji-extra
babel
luatexja
# without \RequirePackage{lmodern} and without cm-super
# Otherwise I was getting errors: 3/bin/pdflatex (file ecss0800): Font ecss0800 at 600 not found
# https://tex.stackexchange.com/questions/267675/pdftex-error-pdflatex-file-ecbx0800-font-ecbx0800-at-600-not-found
cm-super
;
});
in {
formatter = eachSystem (system: pkgsFor.${system}.alejandra);
checks = eachSystem (system: self.packages.${system});
# should probably be call package
packages = eachSystem (system: let
pkgs = pkgsFor.${system};
in rec {
demo-pdflatex = pkgs.callPackage nix/default.nix {
inherit self;
nix-filter = inputs.nix-filter;
tex-deps = tex-deps-builder pkgs.texlive;
tex-directory = ".";
};
demo-pdflatex-montage =
pkgs.runCommand "demo-pdflatex-montage" {
src = ./scripts;
buildInputs = [demo-pdflatex pkgs.nushell pkgs.imagemagickBig];
} ''
mkdir $out
nu --no-history --no-config-file \
$src/create_pngs.nu create-montage demo \
--src-dir ${demo-pdflatex} --target-dir $out
'';
minimal-examples-pdflatex = pkgs.callPackage nix/default.nix {
inherit self;
nix-filter = inputs.nix-filter;
tex-deps = tex-deps-builder pkgs.texlive;
tex-directory = "minimal_examples";
};
minimal-examples-lualatex = pkgs.callPackage nix/default.nix {
inherit self;
nix-filter = inputs.nix-filter;
tex-deps = tex-deps-builder pkgs.texlive;
use-lualatex = true;
tex-directory = "minimal_examples";
};
minimal-examples-pngs =
pkgs.runCommand "minimal-examples-pngs" {
src = ./scripts;
buildInputs = [minimal-examples-lualatex pkgs.nushell pkgs.imagemagickBig];
} ''
mkdir $out
nu --no-history --no-config-file \
$src/create_pngs.nu convert-pdfs-to-pngs \
--src-dir ${minimal-examples-lualatex} --target-dir $out --density 600
'';
compare-examples = pkgs.callPackage nix/default.nix {
inherit self;
nix-filter = inputs.nix-filter;
tex-deps = tex-deps-builder pkgs.texlive;
use-lualatex = true;
tex-directory = "compare_examples";
};
# what is runCommand ?
# just need to call command and provide the given input and output dir!
compare-examples-montage =
pkgs.runCommand "compare-examples-pdf" {
src = ./scripts;
buildInputs = [compare-examples pkgs.nushell pkgs.imagemagickBig];
} ''
mkdir $out
nu --no-history --no-config-file \
$src/create_pngs.nu create-montage compare_examples \
--src-dir ${compare-examples} --target-dir $out
'';
multi-lang-examples = pkgs.callPackage nix/default.nix {
inherit self;
nix-filter = inputs.nix-filter;
tex-deps = tex-deps-builder pkgs.texlive;
use-lualatex = true;
tex-directory = "multi_lang_examples";
};
multi-lang-examples-montage =
pkgs.runCommand "multi-lang-examples-pdf" {
src = ./scripts;
buildInputs = [multi-lang-examples pkgs.nushell pkgs.imagemagickBig];
} ''
mkdir $out
nu --no-history --no-config-file \
$src/create_pngs.nu create-montage multi_lang_examples \
--src-dir ${multi-lang-examples} --target-dir $out
'';
documentation-artifacts = pkgs.symlinkJoin {
name = "documentation-artifacts";
paths = [
multi-lang-examples-montage
compare-examples-montage
demo-pdflatex
demo-pdflatex-montage
minimal-examples-pngs
minimal-examples-lualatex
];
};
});
devShells = eachSystem (
system: let
pkgs = pkgsFor.${system};
in {
default = pkgs.devshell.mkShell {
packages = [
(tex-deps-builder pkgs.texlive)
pkgs.imagemagickBig
pkgs.fd
];
};
}
);
};
}