diff options
Diffstat (limited to 'clef/nix/svg.nix')
| -rw-r--r-- | clef/nix/svg.nix | 92 |
1 files changed, 0 insertions, 92 deletions
diff --git a/clef/nix/svg.nix b/clef/nix/svg.nix deleted file mode 100644 index c93ba87..0000000 --- a/clef/nix/svg.nix +++ /dev/null @@ -1,92 +0,0 @@ -{ - runCommand, - kicad, - inkscape, - - nix-filter, - lib, - - pcb_path, - src, - - withSilk ? true, - withEdgeCuts ? true, - withMirrors ? true, - nLayer ? 2, - - boardName ? (lib.removeSuffix ".kicad_pcb" (builtins.baseNameOf pcb_path)), -}: let - sharePath = "share/npry/clef/svg"; - -in runCommand "${boardName}.svg" { - nativeBuildInputs = [ - kicad - inkscape - ]; - - src = nix-filter { - root = src; - - include = [ - (nix-filter.matchExt "kicad_pcb") - ]; - }; - - nInnerLayer = if nLayer < 2 then 0 else nLayer - 2; - - allowedRequisites = []; -} '' - set -e - - export HOME=$(mktemp -d) - - echo "board: '${boardName}'" >&2 - - mkdir -p $out/${sharePath} - cd "$out/${sharePath}" - - mksvg() { - local infile=$1 - local layers=$2 - local outfile=$3 - - kicad-cli pcb export svg \ - "$infile" \ - -l "$layers" \ - -o "$outfile.svg" \ - --page-size-mode 2 \ - --exclude-drawing-sheet - - inkscape --actions 'select-all;fit-canvas-to-selection' \ - -o "$outfile.trim.svg" \ - "$outfile.svg" - - ${if withMirrors then '' - kicad-cli pcb export svg \ - "$infile" \ - -m \ - -l "$layers" \ - -o "$outfile.mirror.svg" \ - --page-size-mode 2 \ - --exclude-drawing-sheet - - inkscape --actions 'select-all;fit-canvas-to-selection' \ - -o "$outfile.mirror.trim.svg" \ - "$outfile.mirror.svg" - '' else ""} - } - - mksvg "$src/${pcb_path}" \ - "F.Cu,${if withSilk then "F.Silkscreen," else ""}${if withEdgeCuts then "Edge.Cuts," else ""}" \ - front - - mksvg "$src/${pcb_path}" \ - "B.Cu,${if withSilk then "B.Silkscreen," else ""}${if withEdgeCuts then "Edge.Cuts," else ""}" \ - back - - for i in $(seq 1 $nInnerLayer); do - mksvg "$src/${pcb_path}" \ - "In$i.Cu,${if withEdgeCuts then "Edge.Cuts," else ""}" \ - "in$i" - done -'' |
