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
|
{
runCommand,
kicad,
nix-filter,
panel,
}: runCommand "ocularium.svg" {
nativeBuildInputs = [
kicad
];
src = nix-filter {
root = ./..;
exclude = [
"nix"
".gitignore"
"flake.nix"
"flake.lock"
".envrc"
"kikit"
"models"
];
};
allowedRequisites = [];
} ''
set -e
export HOME=$(mktemp -d)
mkdir -p $out/share/npry/ocularium/svg
mkdir -p $out/share/npry/ocularium/panel/svg
mksvg() {
local infile=$1
local layers=$2
local outfile=$3
kicad-cli pcb export svg \
"$infile.kicad_pcb" \
-l "$layers" \
-o $outfile.svg \
--page-size-mode 2 \
--exclude-drawing-sheet
}
readonly okm="$src/okm"
readonly panel="${panel}/share/npry/ocularium/panel"
cd $out/share/npry/ocularium/svg
mksvg "$okm" "F.Cu,F.Silkscreen,Edge.Cuts" front
mksvg "$okm" "B.Cu,B.Silkscreen,Edge.Cuts" back
mksvg "$okm" "In1.Cu,Edge.Cuts" in1
mksvg "$okm" "In2.Cu,Edge.Cuts" in2
cd ../panel/svg
mksvg "$panel" "F.Cu,F.Silkscreen,Edge.Cuts" front
mksvg "$panel" "B.Cu,B.Silkscreen,Edge.Cuts" back
mksvg "$panel" "In1.Cu,Edge.Cuts" in1
mksvg "$panel" "In2.Cu,Edge.Cuts" in2
''
|