Serge Bazanski
8a4725f748
This happens via kiauto and a new Nix build target. The results are not yet pushed anywhere.
68 lines
2.1 KiB
Nix
68 lines
2.1 KiB
Nix
let
|
|
# Tracking nixos-unstable as of 2020-12-13.
|
|
nixpkgsCommit = "e9158eca70ae59e73fae23be5d13d3fa0cfc78b4";
|
|
nixpkgsSrc = fetchTarball {
|
|
url = "https://github.com/NixOS/nixpkgs/archive/${nixpkgsCommit}.tar.gz";
|
|
sha256 = "0cnmvnvin9ixzl98fmlm3g17l6w95gifqfb3rfxs55c0wj2ddy53";
|
|
};
|
|
nixpkgs = import nixpkgsSrc {};
|
|
|
|
|
|
in with nixpkgs; let
|
|
pythonPackages = pkgs.python37Packages;
|
|
|
|
# kiauto is a cursed little Python library to automate KiCAD interaction.
|
|
# It uses a virtual X server (via xvfb) to export PDFs, etc.
|
|
# I wish we didn't have to do this, but KiCAD just isn't very good sometimes.
|
|
kiauto = pythonPackages.buildPythonPackage rec {
|
|
pname = "kiauto";
|
|
version = "1.5.3";
|
|
propagatedBuildInputs = (with pythonPackages; [
|
|
kicad xvfbwrapper psutil
|
|
]) ++ (with pkgs; [
|
|
xdotool xclip
|
|
xorg.xset xorg.setxkbmap
|
|
kicad-small
|
|
]);
|
|
src = pythonPackages.fetchPypi {
|
|
inherit pname version;
|
|
sha256 = "09jr4ym9jq3g8k961169yaqnzhl02vsqs7g3r7wbxlqz4hs1z5yw";
|
|
};
|
|
# fix kiauto/misc.py to point to the right location of KiCAD libraries on Nix.
|
|
patchPhase = ''
|
|
sed -i 's,sys_sym_lib_table = .*$,sys_sym_lib_table = ["${kicad-small.libraries.symbols}/share/kicad/template/sym-lib-table"],' kiauto/misc.py
|
|
sed -i 's,sys_fp_lib_table = .*$,sys_fp_lib_table = ["${kicad-small.libraries.footprints}/share/kicad/template/fp-lib-table"],' kiauto/misc.py
|
|
'';
|
|
};
|
|
|
|
in {
|
|
inherit nixpkgs;
|
|
|
|
# Single build target for everything. This should probably be split up at
|
|
# same later point into multiple subdirectories/subfiles/subtargets - but it
|
|
# will do for now.
|
|
build = stdenv.mkDerivation {
|
|
pname = "fm10k-documentation-build";
|
|
version = "0.1.0";
|
|
|
|
nativeBuildInputs = [
|
|
kicad-small kiauto
|
|
];
|
|
|
|
buildPhase = ''
|
|
mkdir build
|
|
cd build
|
|
export HOME=$(pwd)/home
|
|
mkdir $HOME
|
|
eeschema_do export -a ../PE3100G2DQiRM-QX4.sch .
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out
|
|
cp *pdf $out/
|
|
'';
|
|
|
|
src = ./devices/Silicom/PE3100G2DQiRM-QX4/pcb;
|
|
};
|
|
}
|