Skip to content

Commit e7823e0

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 06bb597 commit e7823e0

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

modules/hooks.nix

+17-3
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 =
@@ -2117,7 +2131,7 @@ in
21172131
name = "chktex";
21182132
description = "LaTeX semantic checker";
21192133
types = [ "file" "tex" ];
2120-
package = tools.chktex;
2134+
package = texliveCombine;
21212135
entry = "${hooks.chktex.package}/bin/chktex";
21222136
};
21232137
clang-format =
@@ -2767,7 +2781,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol
27672781
name = "latexindent";
27682782
description = "Perl script to add indentation to LaTeX files.";
27692783
types = [ "file" "tex" ];
2770-
package = tools.latexindent;
2784+
package = texliveCombine;
27712785
entry = "${hooks.latexindent.package}/bin/latexindent ${hooks.latexindent.settings.flags}";
27722786
};
27732787
lacheck =
@@ -2782,7 +2796,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol
27822796
name = "lacheck";
27832797
description = "A consistency checker for LaTeX documents.";
27842798
types = [ "file" "tex" ];
2785-
package = tools.lacheck;
2799+
package = texliveCombine;
27862800
entry = "${script}";
27872801
};
27882802
lua-ls =

nix/tools.nix

-10
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,6 @@
8989
}:
9090

9191

92-
let
93-
tex = texlive.combine {
94-
inherit (texlive) latexindent chktex scheme-basic;
95-
};
96-
in
9792
{
9893
inherit
9994
actionlint
@@ -188,11 +183,6 @@ in
188183
tflint = callPackage ./tflint { };
189184
dune-build-opam-files = callPackage ./dune-build-opam-files { dune = dune_3; inherit (pkgsBuildBuild) ocaml; };
190185
dune-fmt = callPackage ./dune-fmt { dune = dune_3; inherit (pkgsBuildBuild) ocaml; };
191-
latexindent = tex;
192-
lacheck = texlive.combine {
193-
inherit (texlive) lacheck scheme-basic;
194-
};
195-
chktex = tex;
196186
commitizen = commitizen.overrideAttrs (_: _: { doCheck = false; });
197187
bats = if bats ? withLibraries then (bats.withLibraries (p: [ p.bats-support p.bats-assert p.bats-file ])) else bats;
198188
git-annex = if stdenv.isDarwin then null else git-annex;

0 commit comments

Comments
 (0)