diff options
Diffstat (limited to 'build.nix')
-rw-r--r-- | build.nix | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/build.nix b/build.nix new file mode 100644 index 0000000..3770d57 --- /dev/null +++ b/build.nix @@ -0,0 +1,30 @@ +{ pkgs, teensy-core, ... }: + +{ + build = name: source: pkgs.stdenv.mkDerivation rec { + inherit name; + + src = source; + + buildInputs = with pkgs; [ + gcc-arm-embedded + teensy-core + ]; + + buildPhase = '' + export CC=arm-none-eabi-gcc + export CXX=arm-none-eabi-g++ + export OBJCOPY=arm-none-eabi-objcopy + export SIZE=arm-none-eabi-size + + cp ${./Makefile.default} Makefile + export TEENSY_PATH=${teensy-core} + make + ''; + + installPhase = '' + mkdir $out + cp *.hex $out/ + ''; + }; +} |