Skip to content

Commit b30a815

Browse files
committed
latex: merge LaTeX packages into a single derivation
Merge the packages used by the chktex, lacheck, and latexindent hooks into a single pkgs.texlive.combine derivation to reduce installation size and build time. Only enabled hooks are included in the derivation. Link: #513
1 parent 9364dc0 commit b30a815

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

modules/hooks.nix

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@ let
2222
if hook.settings.binPath == null
2323
then "${hook.package}${binPath}"
2424
else hook.settings.binPath;
25+
26+
texliveCombine = pkgs.texlive.combine (
27+
lib.mergeAttrsList
28+
(
29+
map
30+
(package: { ${package} = pkgs.texlive.${package}; })
31+
(
32+
builtins.filter
33+
(hook: hooks.${hook}.enable)
34+
[ "chktex" "lacheck" "latexindent" ]
35+
)
36+
)
37+
// { inherit (pkgs.texlive) scheme-basic; }
38+
);
2539
in
2640
{
2741
imports =
@@ -2228,7 +2242,7 @@ in
22282242
name = "chktex";
22292243
description = "LaTeX semantic checker";
22302244
types = [ "file" "tex" ];
2231-
package = tools.chktex;
2245+
package = texliveCombine;
22322246
entry = "${hooks.chktex.package}/bin/chktex";
22332247
};
22342248
clang-format =
@@ -2903,7 +2917,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol
29032917
name = "latexindent";
29042918
description = "Perl script to add indentation to LaTeX files.";
29052919
types = [ "file" "tex" ];
2906-
package = tools.latexindent;
2920+
package = texliveCombine;
29072921
entry = "${hooks.latexindent.package}/bin/latexindent ${hooks.latexindent.settings.flags}";
29082922
};
29092923
lacheck =
@@ -2918,7 +2932,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol
29182932
name = "lacheck";
29192933
description = "A consistency checker for LaTeX documents.";
29202934
types = [ "file" "tex" ];
2921-
package = tools.lacheck;
2935+
package = texliveCombine;
29222936
entry = "${script}";
29232937
};
29242938
lua-ls =

nix/tools.nix

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,6 @@
9191
}:
9292

9393

94-
let
95-
tex = texlive.combine {
96-
inherit (texlive) latexindent chktex scheme-basic;
97-
};
98-
in
9994
{
10095
clang-tools = llvmPackages_latest.clang-tools;
10196
inherit
@@ -191,11 +186,6 @@ in
191186
tflint = callPackage ./tflint { };
192187
dune-build-opam-files = callPackage ./dune-build-opam-files { dune = dune_3; inherit (pkgsBuildBuild) ocaml; };
193188
dune-fmt = callPackage ./dune-fmt { dune = dune_3; inherit (pkgsBuildBuild) ocaml; };
194-
latexindent = tex;
195-
lacheck = texlive.combine {
196-
inherit (texlive) lacheck scheme-basic;
197-
};
198-
chktex = tex;
199189
commitizen = commitizen.overrideAttrs (_: _: { doCheck = false; });
200190
bats = if bats ? withLibraries then (bats.withLibraries (p: [ p.bats-support p.bats-assert p.bats-file ])) else bats;
201191
git-annex = if stdenv.isDarwin then null else git-annex;

0 commit comments

Comments
 (0)