-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
96 lines (88 loc) · 2.28 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{
description = "Handbuch zur studentischen Mitwirkung in Berufungskommissionen";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
};
outputs =
inputs@{ self, nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
environment = {
TEXMFHOME = ".cache";
TEXMFVAR = ".cache/texmf-var";
SOURCE_DATE_EPOCH = toString self.lastModified;
};
texlive = pkgs.texlive.combine {
inherit (pkgs.texlive)
babel
collection-fontsrecommended
collection-langgerman
colorprofiles
csquotes
draftwatermark
ec
hyperref
latex-bin
latexmk
mathtools
metafont
microtype
pdfmanagement-testphase
pdfx
scheme-basic
silence
textpos
titlesec
todonotes
wasysym
xkeyval
xmpincl
xstring
;
};
mkDocument =
name:
pkgs.stdenvNoCC.mkDerivation rec {
inherit name;
src = self;
allowSubstitutes = false;
buildInputs = [
pkgs.coreutils
pkgs.gawk
texlive
];
phases = [
"unpackPhase"
"buildPhase"
"installPhase"
];
buildPhase = ''
runHook preBuild
export PATH="${pkgs.lib.makeBinPath buildInputs}";
mkdir -p .cache/texmf-var
env TEXMFHOME=${environment.TEXMFHOME} \
TEXMFVAR=${environment.TEXMFVAR} \
SOURCE_DATE_EPOCH=${environment.SOURCE_DATE_EPOCH} \
latexmk -interaction=nonstopmode -pdf \
${name}.tex
runHook postBuild
'';
installPhase = ''
runHook preInstall
cp ${name}.pdf $out
runHook postInstall
'';
};
in
{
packages."${system}" = rec {
default = bkhandbuch;
bkhandbuch = mkDocument "bkhandbuch";
};
devShells."${system}".default = pkgs.mkShell {
inherit (environment) TEXMFHOME TEXMFVAR SOURCE_DATE_EPOCH;
buildInputs = [ texlive ];
};
};
}