forked from sinara-hw/kirdyAdapter
flake: split copper plate output from "build"
This commit is contained in:
parent
d4e3170c17
commit
2e76fc427a
65
flake.nix
65
flake.nix
@ -9,7 +9,38 @@
|
||||
let
|
||||
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||
|
||||
build = { variant }:
|
||||
build_copper_plate = { }:
|
||||
let
|
||||
copper_plate = pkgs.stdenv.mkDerivation {
|
||||
name = "production-files";
|
||||
src = ./kirdy_LD_adapter_copper_plate;
|
||||
|
||||
nativeBuildInputs = [ pkgs.kicad ];
|
||||
|
||||
PCB = "kirdy_LD_adapter_copper_plate.kicad_pcb";
|
||||
|
||||
buildPhase = ''
|
||||
# kicad-cli requires the use of $HOME
|
||||
export HOME=$(mktemp -d tmp.XXXX)
|
||||
|
||||
# Get Revision Number from the Title Block in KiCAD PCB
|
||||
REV=$(cat $PCB | grep rev | cut -d'"' -f 2)
|
||||
PREFIX=kirdy_LD_adapter_copper_plate_$REV
|
||||
|
||||
export KICAD7_3DMODEL_DIR=${pkgs.kicad.libraries.packages3d}/share/kicad/3dmodels
|
||||
kicad-cli pcb export step $PCB --subst-models --force -o $PREFIX.step
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
|
||||
cp $PREFIX.step $out/$PREFIX.step
|
||||
'';
|
||||
|
||||
};
|
||||
in rec { "LD_adapter_copper_plate_step" = copper_plate; };
|
||||
|
||||
build_PCB = { variant }:
|
||||
let
|
||||
bom = pkgs.stdenv.mkDerivation {
|
||||
name = "bom";
|
||||
@ -162,32 +193,6 @@
|
||||
ln -s ${gerber_and_drill}/$(ls ${gerber_and_drill} | grep "drill") $out
|
||||
'';
|
||||
|
||||
copper_plate_production_files = pkgs.stdenv.mkDerivation {
|
||||
name = "production-files";
|
||||
src = ./kirdy_LD_adapter_copper_plate;
|
||||
|
||||
nativeBuildInputs = [ pkgs.kicad pkgs.zip pkgs.python3 ];
|
||||
|
||||
PCB = "kirdy_LD_adapter_copper_plate.kicad_pcb";
|
||||
|
||||
buildPhase = ''
|
||||
# kicad-cli requires the use of $HOME
|
||||
export HOME=$(mktemp -d tmp.XXXX)
|
||||
|
||||
# Get Revision Number from the Title Block in KiCAD PCB
|
||||
REV=$(cat $PCB | grep rev | cut -d'"' -f 2)
|
||||
PREFIX=kirdy_LD_adapter_copper_plate_$REV
|
||||
|
||||
export KICAD7_3DMODEL_DIR=${pkgs.kicad.libraries.packages3d}/share/kicad/3dmodels
|
||||
kicad-cli pcb export step $PCB --subst-models --force -o $PREFIX.step
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
|
||||
cp $PREFIX.step $out/$PREFIX.step
|
||||
'';
|
||||
};
|
||||
in {
|
||||
"LD_adapter_${variant}_step" = step;
|
||||
"LD_adapter_${variant}_gerber_and_drill" = gerber_and_drill;
|
||||
@ -195,14 +200,14 @@
|
||||
"LD_adapter_${variant}_pos" = pos;
|
||||
"LD_adapter_${variant}_pdf" = pdf;
|
||||
"LD_adapter_${variant}_all_prod_files" = all_prod_files;
|
||||
"LD_adapter_copper_plate" = copper_plate_production_files;
|
||||
};
|
||||
|
||||
in rec {
|
||||
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt;
|
||||
|
||||
packages.x86_64-linux = (build { variant = "type_1"; })
|
||||
// (build { variant = "type_2"; });
|
||||
packages.x86_64-linux = (build_PCB { variant = "type_1"; })
|
||||
// (build_PCB { variant = "type_2"; })
|
||||
// (build_copper_plate { });
|
||||
|
||||
devShells.x86_64-linux.default =
|
||||
let pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
|
Loading…
Reference in New Issue
Block a user