aboutsummaryrefslogtreecommitdiff
path: root/clef/nix/model.nix
diff options
context:
space:
mode:
authorNathan Perry <np@nathanperry.dev>2024-09-02 19:53:43 -0400
committerNathan Perry <np@nathanperry.dev>2024-09-02 19:53:43 -0400
commit982798292719a24bcbb4f9e17cd5c65c8a46ecda (patch)
tree11800fcb5a70f21903aeebed407473420bbe0d41 /clef/nix/model.nix
parent5ddfa32166cee8b2f91f37f9037eb26c182c2125 (diff)
move hw into subdirectory
Diffstat (limited to 'clef/nix/model.nix')
-rw-r--r--clef/nix/model.nix58
1 files changed, 0 insertions, 58 deletions
diff --git a/clef/nix/model.nix b/clef/nix/model.nix
deleted file mode 100644
index da8be82..0000000
--- a/clef/nix/model.nix
+++ /dev/null
@@ -1,58 +0,0 @@
-{
- kicad,
- runCommand,
-
- nix-filter,
- lib,
-
- withTracks ? false,
- withZones ? false,
-
- src,
- pcb_path,
-
- boardName ? (lib.removeSuffix ".kicad_pcb" (builtins.baseNameOf pcb_path)),
-}: let
- zonesArg = if withZones then "--include-zones" else "";
- tracksArg = if withTracks then "--include-tracks" else "";
- sharePath = "share/npry/clef/model";
-
-in runCommand "${boardName}.model" {
- nativeBuildInputs = [
- kicad
- ];
-
- src = nix-filter {
- root = src;
-
- include = [
- (nix-filter.matchExt "kicad_pcb")
- (nix-filter.matchExt "kicad_pro")
-
- (nix-filter.matchExt "stp")
- (nix-filter.matchExt "STP")
- (nix-filter.matchExt "step")
- (nix-filter.matchExt "STEP")
- (nix-filter.matchExt "wrl")
-
- (_args: path: type: type == "directory")
- ];
- };
-
- allowedRequisites = [];
-
- KICAD8_3DMODEL_DIR = "${kicad.libraries.packages3d}/share/kicad/3dmodels";
-} ''
- set -e
-
- export HOME=$(mktemp -d)
-
- echo "board: '${boardName}'" >&2
- echo "KICAD8_3DMODEL_DIR: $KICAD8_3DMODEL_DIR" >&2
-
- mkdir -p $out/${sharePath}
- cd "$src"
-
- kicad-cli pcb export step --subst-models --no-dnp ${tracksArg} ${zonesArg} "${pcb_path}" -o "$out/${sharePath}/${boardName}.step"
- kicad-cli pcb export glb --subst-models --no-dnp ${tracksArg} ${zonesArg} "${pcb_path}" -o "$out/${sharePath}/${boardName}.glb"
-''