Create a single build that builds everything

This commit is contained in:
Savanni D'Gerinel 2022-07-12 22:52:11 -04:00
parent c34886bad5
commit 6787d7484e
1 changed files with 22 additions and 10 deletions

View File

@ -9,8 +9,20 @@
let
version = builtins.string 0 8 self.lastModifiedDate;
supportedSystems = [ "x86_64-linux" "avr-none" ];
in
in rec
{
defaultPackage."x86_64-linux" =
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
in pkgs.symlinkJoin {
name = "avr-monorepo";
paths = [
packages."x86_64-linux"."flame"
packages."x86_64-linux"."prime-tx"
packages."x86_64-linux"."radio-rx"
];
};
packages."x86_64-linux"."flame" =
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
@ -28,12 +40,12 @@
${avr.gcc}/bin/avr-gcc ${CFLAGS} -I${src}/base -o base.o -c ${src}/base/base.c
${avr.gcc}/bin/avr-gcc ${CFLAGS} -I${src}/base -o sk9822.o -c ${src}/sk9822/sk9822.c
${avr.gcc}/bin/avr-gcc ${CFLAGS} -I${src}/base -I${src}/sk9822 -o main.o -c ${src}/flame/main.c
${avr.gcc}/bin/avr-gcc ${CFLAGS} -o main.elf main.o sk9822.o base.o
$OBJCOPY -O ihex main.elf main.hex
${avr.gcc}/bin/avr-gcc ${CFLAGS} -o flame.elf main.o sk9822.o base.o
$OBJCOPY -O ihex flame.elf flame.hex
'';
installPhase = ''
mkdir $out
cp main.elf main.hex $out
cp flame.elf flame.hex $out
'';
};
@ -60,12 +72,12 @@
${avr.gcc}/bin/avr-gcc ${CFLAGS} ${INCLUDE_DIRS} -o reg.o -c ${src}/shift_register/shift_register.c
${avr.gcc}/bin/avr-gcc ${CFLAGS} ${INCLUDE_DIRS} -o display.o -c ${src}/display/display.c
${avr.gcc}/bin/avr-gcc ${CFLAGS} ${INCLUDE_DIRS} -o main.o -c ${src}/prime-tx/main.c
${avr.gcc}/bin/avr-gcc ${CFLAGS} -o main.elf main.o display.o spi.o rfm.o reg.o
$OBJCOPY -O ihex main.elf main.hex
${avr.gcc}/bin/avr-gcc ${CFLAGS} -o prime-tx.elf main.o display.o spi.o rfm.o reg.o
$OBJCOPY -O ihex prime-tx.elf prime-tx.hex
'';
installPhase = ''
mkdir $out
cp main.elf main.hex $out
cp prime-tx.elf prime-tx.hex $out
'';
};
@ -92,12 +104,12 @@
${avr.gcc}/bin/avr-gcc ${CFLAGS} ${INCLUDE_DIRS} -o reg.o -c ${src}/shift_register/shift_register.c
${avr.gcc}/bin/avr-gcc ${CFLAGS} ${INCLUDE_DIRS} -o display.o -c ${src}/display/display.c
${avr.gcc}/bin/avr-gcc ${CFLAGS} ${INCLUDE_DIRS} -o main.o -c ${src}/radio-rx/main.c
${avr.gcc}/bin/avr-gcc ${CFLAGS} -o main.elf main.o display.o spi.o rfm.o reg.o
$OBJCOPY -O ihex main.elf main.hex
${avr.gcc}/bin/avr-gcc ${CFLAGS} -o radio-rx.elf main.o display.o spi.o rfm.o reg.o
$OBJCOPY -O ihex radio-rx.elf radio-rx.hex
'';
installPhase = ''
mkdir $out
cp main.elf main.hex $out
cp radio-rx.elf radio-rx.hex $out
'';
};