2022-03-21 17:50:08 +01:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, pkg-config
|
|
|
|
, pkgsCross
|
|
|
|
, bintools-unwrapped
|
|
|
|
, libffi
|
|
|
|
, libusb1
|
2022-12-03 03:28:32 +01:00
|
|
|
, wxGTK30
|
2022-03-21 17:50:08 +01:00
|
|
|
, python3
|
|
|
|
, gcc-arm-embedded
|
|
|
|
, klipper
|
|
|
|
, avrdude
|
|
|
|
, stm32flash
|
|
|
|
, mcu ? "mcu"
|
|
|
|
, firmwareConfig ? ./simulator.cfg
|
|
|
|
}: stdenv.mkDerivation rec {
|
|
|
|
name = "klipper-firmware-${mcu}-${version}";
|
|
|
|
version = klipper.version;
|
|
|
|
src = klipper.src;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
python3
|
|
|
|
pkgsCross.avr.stdenv.cc
|
|
|
|
gcc-arm-embedded
|
|
|
|
bintools-unwrapped
|
|
|
|
libffi
|
|
|
|
libusb1
|
|
|
|
avrdude
|
|
|
|
stm32flash
|
|
|
|
pkg-config
|
2022-12-03 03:28:32 +01:00
|
|
|
wxGTK30 # Required for bossac
|
2022-03-21 17:50:08 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
preBuild = "cp ${firmwareConfig} ./.config";
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
patchShebangs .
|
|
|
|
'';
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"V=1"
|
|
|
|
"KCONFIG_CONFIG=${firmwareConfig}"
|
|
|
|
];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
cp ./.config $out/config
|
|
|
|
cp -r out/* $out
|
2022-03-22 11:23:40 +01:00
|
|
|
'';
|
2022-03-21 17:50:08 +01:00
|
|
|
|
|
|
|
dontFixup = true;
|
|
|
|
|
2022-03-21 21:04:23 +01:00
|
|
|
meta = with lib; {
|
2022-03-21 17:50:08 +01:00
|
|
|
inherit (klipper.meta) homepage license;
|
|
|
|
description = "Firmware part of Klipper";
|
2022-03-21 21:04:23 +01:00
|
|
|
maintainers = with maintainers; [ vtuan10 ];
|
|
|
|
platforms = platforms.linux;
|
2022-03-21 17:50:08 +01:00
|
|
|
};
|
|
|
|
}
|