You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.0 KiB

  1. # dfu-programmer doesn't have darwin on it's list of supported platforms
  2. { pkgs ? import <nixpkgs> { config = { allowUnsupportedSystem = true; }; }
  3. , avr ? true, arm ? true, teensy ? true }:
  4. with pkgs;
  5. let
  6. avr_incflags = [
  7. "-isystem ${avrlibc}/avr/include"
  8. "-B${avrlibc}/avr/lib/avr5"
  9. "-L${avrlibc}/avr/lib/avr5"
  10. "-B${avrlibc}/avr/lib/avr35"
  11. "-L${avrlibc}/avr/lib/avr35"
  12. "-B${avrlibc}/avr/lib/avr51"
  13. "-L${avrlibc}/avr/lib/avr51"
  14. ];
  15. avrgcc = pkgs.avrgcc.overrideAttrs (oldAttrs: rec {
  16. name = "avr-gcc-8.1.0";
  17. src = fetchurl {
  18. url = "mirror://gcc/releases/gcc-8.1.0/gcc-8.1.0.tar.xz";
  19. sha256 = "0lxil8x0jjx7zbf90cy1rli650akaa6hpk8wk8s62vk2jbwnc60x";
  20. };
  21. });
  22. in
  23. stdenv.mkDerivation {
  24. name = "qmk-firmware";
  25. buildInputs = [ dfu-programmer dfu-util diffutils git ]
  26. ++ lib.optional avr [ avrbinutils avrgcc avrlibc avrdude ]
  27. ++ lib.optional arm [ gcc-arm-embedded ]
  28. ++ lib.optional teensy [ teensy-loader-cli ];
  29. CFLAGS = lib.optional avr avr_incflags;
  30. ASFLAGS = lib.optional avr avr_incflags;
  31. }