moloch-dragon/package.nix

88 lines
1.5 KiB
Nix

{
writeShellScript,
writableTmpDirAsHomeHook,
stdenvNoCC,
texlivePackages,
texliveBasic,
}:
let
texEnv = texliveBasic.withPackages (ps: with ps; [
# l3build
beamer
biblatex
enumitem
fileinfo
hypdoc
hyperref
listings
metalogo
parskip
pgf
pgfopts
setspace
xurl
microtype
latexmk
]);
in stdenvNoCC.mkDerivation rec {
pname = "moloch";
version = "1.0.2-DEV-xenia";
outputs = [
"tex"
"texdoc"
];
passthru.tlDeps = with texlivePackages; [ latex ];
src = ./.;
dontConfigure = true;
nativeBuildInputs = [
texEnv
# multiple-outputs.sh fails if $out is not defined
(writeShellScript "force-tex-output.sh" ''
out="''${tex-}"
'')
writableTmpDirAsHomeHook # Need a writable $HOME for latexmk
];
# we just build manually, but moloch's own method of building is using l3build
# i have no idea how to get that working, so for now just do it normal style
buildPhase = ''
runHook preBuild
# Generate the style files
cd src
latex beamertheme${pname}.ins
# Generate the documentation
cp ../doc/${pname}.tex .
latexmk -pdf ${pname}.tex
cd ..
runHook postBuild
'';
installPhase = ''
runHook preInstall
path="$tex/tex/latex/${pname}"
mkdir -p "$path"
cp src/*.{cls,def,clo,sty} "$path/"
path="$texdoc/doc/tex/latex/${pname}"
mkdir -p "$path"
cp src/${pname}.pdf "$path/"
runHook postInstall
'';
}