diff options
| author | Nathan Perry <np@nathanperry.dev> | 2024-09-02 19:53:43 -0400 |
|---|---|---|
| committer | Nathan Perry <np@nathanperry.dev> | 2024-09-02 19:53:43 -0400 |
| commit | 982798292719a24bcbb4f9e17cd5c65c8a46ecda (patch) | |
| tree | 11800fcb5a70f21903aeebed407473420bbe0d41 /hw/clef/nix/panel.nix | |
| parent | 5ddfa32166cee8b2f91f37f9037eb26c182c2125 (diff) | |
move hw into subdirectory
Diffstat (limited to 'hw/clef/nix/panel.nix')
| -rw-r--r-- | hw/clef/nix/panel.nix | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/hw/clef/nix/panel.nix b/hw/clef/nix/panel.nix new file mode 100644 index 0000000..1d88d46 --- /dev/null +++ b/hw/clef/nix/panel.nix @@ -0,0 +1,46 @@ +{ + kikit, + runCommand, + + nix-filter, + lib, + + panelizeConfigs, + src, + pcb_path, + + boardName ? (lib.removeSuffix ".kicad_pcb" (builtins.baseNameOf pcb_path)), +}: let + sharePath = "share/npry/clef/panel"; + + panelSrc = nix-filter { + root = src; + + include = [ + (nix-filter.matchExt "kicad_pcb") + ]; + }; + +in runCommand "${boardName}.panel" { + nativeBuildInputs = [ + kikit + ]; + + allowedRequisites = []; +} '' + set -e + export HOME=$(mktemp -d) + + mkdir -p "$out/${sharePath}" + + # do the panelize here rather than in $out because it creates junk we don't want + cd $HOME + + kikit panelize \ + ${lib.concatMapStrings (conf: "-p ${conf} \\\n") panelizeConfigs} \ + "${panelSrc}/${pcb_path}" \ + "panel.kicad_pcb" + + cp -v panel.kicad_{pcb,pro} "$out/${sharePath}" + cp -v "${src}/"*.kicad_{sch,pro} "$out/${sharePath}" +'' |
