-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
64 lines (54 loc) · 1.78 KB
/
default.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
let
sources = import ./nix/sources.nix;
overlays = import ./nix/overlays.nix;
nixpkgs = import sources.nixpkgs { inherit overlays; };
pkgs = import nixpkgs {};
inherit (import sources.hypered-design) replace-md-links static;
template = ./template.html;
to-html = src: nixpkgs.runCommand "html" {} ''
${nixpkgs.pandoc}/bin/pandoc \
--from markdown \
--to html \
--standalone \
--template ${template} \
-M prefix="" \
--output $out \
${fr/metadata.yml} \
${src}
'';
in rec
{
fr.md.index = fr/index.md;
fr.md.formations = fr/formations.md;
fr.md.contact = fr/contact.md;
fr.md.git = fr/git.md;
fr.md.docker = fr/docker.md;
fr.html.index = to-html fr.md.index;
fr.html.formations = to-html fr.md.formations;
fr.html.contact = to-html fr.md.contact;
fr.html.git = to-html fr.md.git;
fr.html.docker = to-html fr.md.docker;
html.all = nixpkgs.runCommand "all" {} ''
mkdir -p $out/fr
echo "hypered.be" > $out/index.html
cp ${fr.html.index} $out/fr/index.html
cp ${fr.html.formations} $out/fr/formations.html
cp ${fr.html.contact} $out/fr/contact.html
cp ${fr.html.git} $out/fr/git.html
cp ${fr.html.docker} $out/fr/docker.html
${nixpkgs.bash}/bin/bash ${replace-md-links} $out
# Temporary. These pages are manually generated (and committed)
# from the struct/ directory.
cp ${./hard-coded}/index.html $out/
cp ${./hard-coded}/contact.html $out/
cp -r ${./hard-coded}/en $out/
'';
# all + static, to serve locally with scripts/serve.sh
html.all-with-static = nixpkgs.runCommand "all-with-static" {} ''
mkdir $out
cp -r ${html.all}/* $out/
cp -r ${static} $out/static
chmod -R +w $out/static/images/
cp ${./static/images}/* $out/static/images/
'';
}