-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
99 lines (81 loc) · 2.75 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
{
description = "European Commission beamer presentation";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
ec-theme.url = "git+https://code.europa.eu/pol/european-commission-latex-beamer-theme/";
ec-fonts.url = "git+https://code.europa.eu/pol/ec-fonts/";
ci-detector.url = "github:loophp/ci-detector";
};
outputs = { self, nixpkgs, flake-utils, ec-theme, ec-fonts, ci-detector, ... }@inputs:
flake-utils.lib.eachDefaultSystem (system:
let
version = self.shortRev or self.lastModifiedDate;
pkgs = import nixpkgs {
inherit system;
overlays = [
ec-theme.overlays.default
ec-fonts.overlays.default
];
};
pandoc = pkgs.writeShellScriptBin "pandoc" ''
${pkgs.pandoc}/bin/pandoc --data-dir ${pkgs.pandoc-template-ec} $@
'';
tex = pkgs.texlive.combine {
inherit (pkgs.texlive) scheme-full latex-bin latexmk;
latex-theme-ec = {
pkgs = [ pkgs.latex-theme-ec pkgs.ec-square-sans-lualatex ];
};
};
tex-for-ci = pkgs.texlive.combine {
inherit (pkgs.texlive) scheme-full latex-bin latexmk;
latex-theme-ec = {
pkgs = [ pkgs.latex-theme-ec ];
};
};
myaspell = pkgs.aspellWithDicts (d: [d.en d.en-science d.en-computers d.fr d.be]);
pandoc-presentation = pkgs.stdenvNoCC.mkDerivation {
name = "ec-pandoc-presentation";
src = pkgs.lib.cleanSource ./.;
buildInputs = [
pandoc
pkgs.gnumake
pkgs.nodePackages.cspell
myaspell
];
buildPhase = ''
make build-pandoc-presentation
'';
installPhase = ''
runHook preInstall
install -m644 -D *.pdf --target $out/
runHook postInstall
'';
};
in
{
packages.default = if ci-detector.lib.inCI then
(pandoc-presentation.overrideAttrs (oldAttrs: {
buildInputs = [ oldAttrs.buildInputs ] ++ [ tex-for-ci ];
}))
else
(pandoc-presentation.overrideAttrs (oldAttrs: {
buildInputs = [ oldAttrs.buildInputs ] ++ [ tex ];
}));
# Nix develop
devShells.default = pkgs.mkShellNoCC {
name = "ec-presentation-devshell";
buildInputs = [
tex
pandoc
pkgs.gnumake
pkgs.nodePackages.cspell
pkgs.nodePackages.prettier
myaspell
pkgs.inotify-tools
pkgs.nixpkgs-fmt
pkgs.nixfmt
];
};
});
}