-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
99 lines (94 loc) · 3.31 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
97
98
99
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
devshell.url = "github:numtide/devshell";
devshell.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, flake-utils, devshell, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs =
import nixpkgs {
inherit system;
overlays = [ devshell.overlays.default ];
};
tex = pkgs.texlive.combine {
inherit (pkgs.texlive)
scheme-basic amsfonts beamer babel-german tcolorbox emoji environ
ccicons csquotes csvsimple doclicense fancyvrb fontspec gobble
koma-script ifmtarg latexmk lm markdown mathtools minted noto
nunito pgf relsize soul unicode-math lualatex-math gitinfo2
eso-pic biblatex biblatex-trad biblatex-software xkeyval xurl
xifthen biber dirtytalk tikzsymbols pgfornament pgfopts bbding
transparent pdfpc hyperxmp luacode luatexbase adjustbox
tikzfill caption qrcode upquote breakurl accsupp metafont;
};
documents = (builtins.fromTOML (builtins.readFile ./documents.toml)).documents;
in
{
packages = builtins.listToAttrs (
builtins.map
({ name, ... } @ meta:
{
inherit name;
value = pkgs.stdenvNoCC.mkDerivation {
inherit name;
srcs = [ (./. + "/${name}") ./tex ];
sourceRoot = "./${name}";
nativeBuildInputs = with pkgs; [
google-fonts
tex
];
buildPhase = ''
export HOME=$(mktemp -d)
latexmk
'';
installPhase = ''
mkdir --parent -- $out
mv *.pdf $out/
'';
passthru = meta;
};
}
)
documents);
devShells.default = (pkgs.devshell.mkShell {
name = "rosenpass-slides-dev-shell";
packages = with pkgs; [ tex nixpkgs-fmt google-fonts nodePackages.prettier ];
commands = [
{
name = "build";
command = ''
latexmk
'';
help = "build the slides";
}
{
name = "clean";
command = ''
latexmk -c
'';
help = "build the slides";
}
];
});
checks = {
nixpkgs-fmt = pkgs.runCommand "check-nixpkgs-fmt"
{ nativeBuildInputs = [ pkgs.nixpkgs-fmt ]; } ''
nixpkgs-fmt --check ${./.} && touch $out
'';
prettier-check = pkgs.runCommand "check-with-prettier"
{ nativeBuildInputs = [ pkgs.nodePackages.prettier ]; } ''
cd ${./.} && prettier --check . && touch $out
'';
# 1. for every folder that is not hidden there must be a package
# consistency-check = pkgs.runCommand "check-consistency"
# { nativeBuildInputs = [ ]; } ''
# cd ${./.}
# find -mindepth 1 -maxdepth 1 -type d -not -path '*/.*'
# '';
};
}
);
}