Skip to content

Commit 86a3abd

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.
1 parent 1211305 commit 86a3abd

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 =
@@ -2030,7 +2044,7 @@ in
20302044
name = "chktex";
20312045
description = "LaTeX semantic checker";
20322046
types = [ "file" "tex" ];
2033-
package = tools.chktex;
2047+
package = texliveCombine;
20342048
entry = "${hooks.chktex.package}/bin/chktex";
20352049
};
20362050
clang-format =
@@ -2680,7 +2694,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol
26802694
name = "latexindent";
26812695
description = "Perl script to add indentation to LaTeX files.";
26822696
types = [ "file" "tex" ];
2683-
package = tools.latexindent;
2697+
package = texliveCombine;
26842698
entry = "${hooks.latexindent.package}/bin/latexindent ${hooks.latexindent.settings.flags}";
26852699
};
26862700
lacheck =
@@ -2695,7 +2709,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol
26952709
name = "lacheck";
26962710
description = "A consistency checker for LaTeX documents.";
26972711
types = [ "file" "tex" ];
2698-
package = tools.lacheck;
2712+
package = texliveCombine;
26992713
entry = "${script}";
27002714
};
27012715
lua-ls =

nix/tools.nix

Lines changed: 0 additions & 10 deletions
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)