Peter's keyboard firmware (QMK) https://qmk.fm/
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.

51 lines
1.5KB

  1. { avr ? true, arm ? true, teensy ? true }:
  2. let
  3. overlay = self: super:
  4. let addDarwinSupport = pkg: pkg.overrideAttrs (oldAttrs: {
  5. meta.platforms = (oldAttrs.meta.platforms or []) ++ self.lib.platforms.darwin;
  6. });
  7. in {
  8. dfu-programmer = addDarwinSupport super.dfu-programmer;
  9. teensy-loader-cli = addDarwinSupport super.teensy-loader-cli;
  10. avrgcc = super.avrgcc.overrideAttrs (oldAttrs: rec {
  11. name = "avr-gcc-8.1.0";
  12. src = super.fetchurl {
  13. url = "mirror://gcc/releases/gcc-8.1.0/gcc-8.1.0.tar.xz";
  14. sha256 = "0lxil8x0jjx7zbf90cy1rli650akaa6hpk8wk8s62vk2jbwnc60x";
  15. };
  16. });
  17. };
  18. nixpkgs = builtins.fetchTarball {
  19. url = "https://github.com/NixOS/nixpkgs/archive/0260747427737b980f0.tar.gz";
  20. sha256 = "1p2yc6b40xvvxvmlqd9wb440pkrimnlc2wsbpa5rddlpx1dn8qmf";
  21. };
  22. pkgs = import nixpkgs { overlays = [ overlay ]; };
  23. in
  24. with pkgs;
  25. let avr_incflags = [
  26. "-isystem ${avrlibc}/avr/include"
  27. "-B${avrlibc}/avr/lib/avr5"
  28. "-L${avrlibc}/avr/lib/avr5"
  29. "-B${avrlibc}/avr/lib/avr35"
  30. "-L${avrlibc}/avr/lib/avr35"
  31. "-B${avrlibc}/avr/lib/avr51"
  32. "-L${avrlibc}/avr/lib/avr51"
  33. ];
  34. in
  35. stdenv.mkDerivation {
  36. name = "qmk-firmware";
  37. buildInputs = [ dfu-programmer dfu-util diffutils git python3 ]
  38. ++ lib.optional avr [ avrbinutils avrgcc avrlibc avrdude ]
  39. ++ lib.optional arm [ gcc-arm-embedded ]
  40. ++ lib.optional teensy [ teensy-loader-cli ];
  41. CFLAGS = lib.optional avr avr_incflags;
  42. ASFLAGS = lib.optional avr avr_incflags;
  43. }