Skip to content

Commit

Permalink
latex: merge LaTeX packages into a single derivation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
trueNAHO committed Oct 11, 2024
1 parent 1211305 commit 86a3abd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
20 changes: 17 additions & 3 deletions modules/hooks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ let
if hook.settings.binPath == null
then "${hook.package}${binPath}"
else hook.settings.binPath;

texliveCombine = pkgs.texlive.combine (
lib.mergeAttrsList
(
map
(package: { ${package} = pkgs.texlive.${package}; })
(
builtins.filter
(hook: hooks.${hook}.enable)
[ "chktex" "lacheck" "latexindent" ]
)
)
// { inherit (pkgs.texlive) scheme-basic; }
);
in
{
imports =
Expand Down Expand Up @@ -2030,7 +2044,7 @@ in
name = "chktex";
description = "LaTeX semantic checker";
types = [ "file" "tex" ];
package = tools.chktex;
package = texliveCombine;
entry = "${hooks.chktex.package}/bin/chktex";
};
clang-format =
Expand Down Expand Up @@ -2680,7 +2694,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol
name = "latexindent";
description = "Perl script to add indentation to LaTeX files.";
types = [ "file" "tex" ];
package = tools.latexindent;
package = texliveCombine;
entry = "${hooks.latexindent.package}/bin/latexindent ${hooks.latexindent.settings.flags}";
};
lacheck =
Expand All @@ -2695,7 +2709,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol
name = "lacheck";
description = "A consistency checker for LaTeX documents.";
types = [ "file" "tex" ];
package = tools.lacheck;
package = texliveCombine;
entry = "${script}";
};
lua-ls =
Expand Down
10 changes: 0 additions & 10 deletions nix/tools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,6 @@
}:


let
tex = texlive.combine {
inherit (texlive) latexindent chktex scheme-basic;
};
in
{
inherit
actionlint
Expand Down Expand Up @@ -188,11 +183,6 @@ in
tflint = callPackage ./tflint { };
dune-build-opam-files = callPackage ./dune-build-opam-files { dune = dune_3; inherit (pkgsBuildBuild) ocaml; };
dune-fmt = callPackage ./dune-fmt { dune = dune_3; inherit (pkgsBuildBuild) ocaml; };
latexindent = tex;
lacheck = texlive.combine {
inherit (texlive) lacheck scheme-basic;
};
chktex = tex;
commitizen = commitizen.overrideAttrs (_: _: { doCheck = false; });
bats = if bats ? withLibraries then (bats.withLibraries (p: [ p.bats-support p.bats-assert p.bats-file ])) else bats;
git-annex = if stdenv.isDarwin then null else git-annex;
Expand Down

0 comments on commit 86a3abd

Please sign in to comment.