aboutsummaryrefslogtreecommitdiff
path: root/hw/clef/nix/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'hw/clef/nix/default.nix')
-rw-r--r--hw/clef/nix/default.nix61
1 files changed, 61 insertions, 0 deletions
diff --git a/hw/clef/nix/default.nix b/hw/clef/nix/default.nix
new file mode 100644
index 0000000..419c8fd
--- /dev/null
+++ b/hw/clef/nix/default.nix
@@ -0,0 +1,61 @@
+{
+ pkgs,
+
+ src,
+ main_pcb,
+ main_sch,
+
+ name,
+ outPath ? "share/npry/clef",
+ layers ? 2,
+
+ # set to a list of arguments to be passed to `kikit panelize -p`
+ panelizeConfigs ? null,
+}: let
+ pcb_path = main_pcb;
+ sch_path = main_sch;
+
+ pcb_args = {
+ inherit pcb_path src;
+ };
+
+ panelSrc = if panelizeConfigs != null then pkgs.callPackage ./panel.nix (pcb_args // { inherit panelizeConfigs; }) else null;
+
+ panel = if panelizeConfigs != null then
+ pkgs.callPackage ./. {
+ src = "${panelSrc}/share/npry/clef/panel";
+ main_pcb = "panel.kicad_pcb";
+
+ name = "${name}.sub.panel";
+ outPath = "${outPath}/panel";
+
+ inherit main_sch layers;
+ }
+ else null;
+
+ svg = pkgs.callPackage ./svg.nix (pcb_args // { nLayer = layers; });
+ model = pkgs.callPackage ./model.nix pcb_args;
+
+ bom = pkgs.callPackage ./bom.nix pcb_args;
+
+ fabrication = pkgs.callPackage ./fabrication.nix (pcb_args // {
+ inherit sch_path;
+ });
+
+ schematic = pkgs.callPackage ./schematic.nix {
+ inherit sch_path src;
+ };
+
+in pkgs.callPackage ./board.nix {
+ inherit
+ svg
+ model
+ bom
+ fabrication
+ schematic
+ name
+ outPath
+ panel
+ panelSrc
+ ;
+}