From a330a1fad3c1ccdd926297747c03fe95bcaa6587 Mon Sep 17 00:00:00 2001 From: Nathan Perry Date: Wed, 14 Aug 2024 01:34:16 -0400 Subject: nix: migrate functionality to clef --- nix/svg.nix | 82 ------------------------------------------------------------- 1 file changed, 82 deletions(-) delete mode 100644 nix/svg.nix (limited to 'nix/svg.nix') diff --git a/nix/svg.nix b/nix/svg.nix deleted file mode 100644 index fc1a404..0000000 --- a/nix/svg.nix +++ /dev/null @@ -1,82 +0,0 @@ -{ - runCommand, - kicad, - - 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 - ]; - - 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 - - ${if withMirrors then '' - kicad-cli pcb export svg \ - "$infile" \ - -m \ - -l "$layers" \ - -o "$outfile.mirror.svg" \ - --page-size-mode 2 \ - --exclude-drawing-sheet - '' 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 -'' -- cgit v1.3.1