-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
37 lines (33 loc) · 969 Bytes
/
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
{ lib, writeText, stdenv, inkscape, fira, fontconfig, tree, size ? 4096 }:
let
# Gerar fontconfig com a Fira Sans inclusa
fontConf = writeText "00-fira-fonts.conf" ''
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<dir>${fira}/share/fonts/opentype/</dir>
</fontconfig>
'';
in
stdenv.mkDerivation {
name = "gelos-identidade-visual";
src = ./src;
buildInputs = [ inkscape fontconfig fira tree ];
FONTCONFIG_FILE=fontConf;
# Renderizar SVGs em PNGs
# E criar árvores html para indexar os arquivos
buildPhase = let
tree = ''tree -T "Identidade Visual GELOS" -H '.' --noreport -I "index.html" --charset utf-8'';
in ''
inkscape --export-type=png **/*.svg -w ${toString size} -h ${toString size}
${tree} -o index.html .
for d in */; do
${tree} -o "$d/index.html" "$d"
done
'';
# Mover imagens para output
installPhase = ''
mkdir -p $out
cp -r * $out
'';
}