diff --git a/flake.nix b/flake.nix index 13bafa8..ebb44c3 100644 --- a/flake.nix +++ b/flake.nix @@ -58,7 +58,6 @@ dontConfigure = true; buildPhase = '' - set -x for source in ${src}/*.c; do if [ -e $source ]; then ${gcc} ${cflags} ${include_dirs} -c $source @@ -253,199 +252,6 @@ ]; }; - /* - packages."x86_64-linux"."animation-test" = - let - pkgs = import nixpkgs { system = "x86_64-linux"; }; - lib = pkgs.lib; - in pkgs.stdenv.mkDerivation rec { - name = "animation-test"; - src = ./.; - - buildInputs = [ - (packages."x86_64-linux"."animation" { inherit gcc; }) - ]; - - INCLUDE_DIRS = lib.concatStringsSep " " (map (dir: "-I${dir}") buildInputs); - OBJECT_FILES = lib.concatStringsSep " " (map (dir: "${dir}/*.o") buildInputs); - gcc = "${pkgs.gcc}/bin/gcc"; - - buildPhase = '' - ${gcc} ${INCLUDE_DIRS} -o main.o -c ${src}/animation/main.c - ${gcc} ${INCLUDE_DIRS} -o animation-test main.o ${OBJECT_FILES} - ''; - installPhase = '' - mkdir $out - cp animation-test $out - ''; - }; - - packages."x86_64-linux"."flame" = - { mcu, chip_select, f_cpu }: - let - pkgs = import nixpkgs { system = "x86_64-linux"; }; - lib = pkgs.lib; - avr = pkgs.pkgsCross.avr.buildPackages; - in pkgs.stdenv.mkDerivation rec { - name = "flame"; - src = ./.; - - buildInputs = [ - (packages."x86_64-linux"."dio" { inherit mcu chip_select f_cpu; }) - (packages."x86_64-linux"."sk9822" { inherit mcu chip_select f_cpu; }) - (packages."x86_64-linux"."rng" { inherit mcu chip_select f_cpu; }) - (packages."x86_64-linux"."animation" { inherit mcu chip_select f_cpu; - gcc = "${avr.gcc}/bin/avr-gcc"; }) - ]; - - CFLAGS = mcu_cflags { inherit mcu chip_select f_cpu; }; - INCLUDE_DIRS = pkgs.lib.concatStringsSep " " (map (dir: "-I${dir}") buildInputs); - OBJECT_FILES = pkgs.lib.concatStringsSep " " (map (dir: "${dir}/*.o") buildInputs); - - buildPhase = '' - ${avr.gcc}/bin/avr-gcc ${CFLAGS} ${INCLUDE_DIRS} -o main.o -c ${src}/flame/main.c - ${avr.gcc}/bin/avr-gcc ${CFLAGS} ${INCLUDE_DIRS} -o flame.elf main.o ${OBJECT_FILES} - $OBJCOPY -O ihex flame.elf flame.hex - ''; - installPhase = '' - mkdir $out - cp flame.elf flame.hex $out - ''; - }; - - packages."x86_64-linux"."prime-tx" = - { mcu, chip_select, f_cpu }: - let - pkgs = import nixpkgs { system = "x86_64-linux"; }; - lib = pkgs.lib; - avr = pkgs.pkgsCross.avr.buildPackages; - in pkgs.stdenv.mkDerivation rec { - name = "prime-tx"; - src = ./.; - - buildInputs = [ - (packages."x86_64-linux"."dio" { inherit mcu chip_select f_cpu; }) - (packages."x86_64-linux"."spi" { inherit mcu chip_select f_cpu; }) - (packages."x86_64-linux"."shift-register" { inherit mcu chip_select f_cpu; }) - (packages."x86_64-linux"."rfm" { inherit mcu chip_select f_cpu; }) - (packages."x86_64-linux"."display" { inherit mcu chip_select f_cpu; }) - ]; - - CFLAGS = mcu_cflags { inherit mcu chip_select f_cpu; }; - INCLUDE_DIRS = pkgs.lib.concatStringsSep " " (map (dir: "-I${dir}") buildInputs); - OBJECT_FILES = pkgs.lib.concatStringsSep " " (map (dir: "${dir}/*.o") buildInputs); - - - buildPhase = '' - ${avr.gcc}/bin/avr-gcc ${CFLAGS} ${INCLUDE_DIRS} -o main.o -c ${src}/prime-tx/main.c - ${avr.gcc}/bin/avr-gcc ${CFLAGS} -o prime-tx.elf main.o ${OBJECT_FILES} - $OBJCOPY -O ihex prime-tx.elf prime-tx.hex - ''; - - installPhase = '' - mkdir $out - cp prime-tx.elf prime-tx.hex $out - ''; - }; - - packages."x86_64-linux"."radio-rx" = - { mcu, chip_select, f_cpu }: - let - pkgs = import nixpkgs { system = "x86_64-linux"; }; - lib = pkgs.lib; - avr = pkgs.pkgsCross.avr.buildPackages; - in pkgs.stdenv.mkDerivation rec { - name = "radio-rx"; - src = ./.; - - buildInputs = [ - (packages."x86_64-linux"."dio" { inherit mcu chip_select f_cpu; }) - (packages."x86_64-linux"."spi" { inherit mcu chip_select f_cpu; }) - (packages."x86_64-linux"."shift-register" { inherit mcu chip_select f_cpu; }) - (packages."x86_64-linux"."rfm" { inherit mcu chip_select f_cpu; }) - (packages."x86_64-linux"."display" { inherit mcu chip_select f_cpu; }) - ]; - - CFLAGS = mcu_cflags { inherit mcu chip_select f_cpu; }; - INCLUDE_DIRS = pkgs.lib.concatStringsSep " " (map (dir: "-I${dir}") buildInputs); - OBJECT_FILES = pkgs.lib.concatStringsSep " " (map (dir: "${dir}/*.o") buildInputs); - - buildPhase = '' - ${avr.gcc}/bin/avr-gcc ${CFLAGS} ${INCLUDE_DIRS} -o main.o -c ${src}/radio-rx/main.c - ${avr.gcc}/bin/avr-gcc ${CFLAGS} -o radio-rx.elf main.o ${OBJECT_FILES} - $OBJCOPY -O ihex radio-rx.elf radio-rx.hex - ''; - installPhase = '' - mkdir $out - cp radio-rx.elf radio-rx.hex $out - ''; - }; - - packages."x86_64-linux"."interrupts-standalone" = (packages."x86_64-linux"."interrupts" atmega32u4); - - packages."x86_64-linux"."interrupts" = - { mcu, chip_select, f_cpu }: - let - pkgs = import nixpkgs { system = "x86_64-linux"; }; - lib = pkgs.lib; - avr = pkgs.pkgsCross.avr.buildPackages; - in pkgs.stdenv.mkDerivation rec { - name = "interrupts"; - src = ./.; - - buildInputs = [ - (packages."x86_64-linux"."dio" { inherit mcu chip_select f_cpu; }) - (packages."x86_64-linux"."shift-register" { inherit mcu chip_select f_cpu; }) - (packages."x86_64-linux"."display" { inherit mcu chip_select f_cpu; }) - ]; - - CFLAGS = mcu_cflags { inherit mcu chip_select f_cpu; }; - INCLUDE_DIRS = pkgs.lib.concatStringsSep " " (map (dir: "-I${dir}") buildInputs); - OBJECT_FILES = pkgs.lib.concatStringsSep " " (map (dir: "${dir}/*.o") buildInputs); - - buildPhase = '' - ${avr.gcc}/bin/avr-gcc ${CFLAGS} ${INCLUDE_DIRS} -o main.o -c ${src}/interrupts/main.c - ${avr.gcc}/bin/avr-gcc ${CFLAGS} -o interrupts.elf main.o ${OBJECT_FILES} - $OBJCOPY -O ihex interrupts.elf interrupts.hex - ''; - installPhase = '' - mkdir $out - cp interrupts.elf interrupts.hex $out - ''; - }; - - packages."x86_64-linux"."power-management-standalone" = (packages."x86_64-linux"."power-management" attiny85); - - packages."x86_64-linux"."power-management" = - { mcu, chip_select, f_cpu }: - let - pkgs = import nixpkgs { system = "x86_64-linux"; }; - lib = pkgs.lib; - avr = pkgs.pkgsCross.avr.buildPackages; - in pkgs.stdenv.mkDerivation rec { - name = "power-management"; - src = ./.; - - buildInputs = [ - (packages."x86_64-linux"."dio" { inherit mcu chip_select f_cpu; }) - ]; - - CFLAGS = mcu_cflags { inherit mcu chip_select f_cpu; }; - INCLUDE_DIRS = pkgs.lib.concatStringsSep " " (map (dir: "-I${dir}") buildInputs); - OBJECT_FILES = pkgs.lib.concatStringsSep " " (map (dir: "${dir}/*.o") buildInputs); - - buildPhase = '' - ${avr.gcc}/bin/avr-gcc ${CFLAGS} ${INCLUDE_DIRS} -o main.o -c ${src}/power-management/main.c - ${avr.gcc}/bin/avr-gcc ${CFLAGS} -o power-management.elf main.o ${OBJECT_FILES} - $OBJCOPY -O ihex power-management.elf power-management.hex - ''; - installPhase = '' - mkdir $out - cp power-management.elf power-management.hex $out - ''; - }; - */ - devShell."x86_64-linux" = let pkgs = import nixpkgs { system = "x86_64-linux"; };