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.

71 lines
1.7KB

  1. { avr ? true, arm ? true, teensy ? true }:
  2. let
  3. nixpkgs = builtins.fetchTarball {
  4. url = "https://github.com/NixOS/nixpkgs/archive/903266491b7b9b0379e88709feca0af900def0d9.tar.gz";
  5. sha256 = "1b5wjrfgyha6s15k1yjyx41hvrpmd5szpkpkxk6l5hyrfqsr8wip";
  6. };
  7. pkgs = import nixpkgs { };
  8. hjson = with pkgs.python3Packages; buildPythonPackage rec {
  9. pname = "hjson";
  10. version = "3.0.1";
  11. src = fetchPypi {
  12. inherit pname version;
  13. sha256 = "1yaimcgz8w0ps1wk28wk9g9zdidp79d14xqqj9rjkvxalvx2f5qx";
  14. };
  15. doCheck = false;
  16. };
  17. pythonEnv = pkgs.python3.withPackages (p: with p; [
  18. # requirements.txt
  19. appdirs
  20. argcomplete
  21. colorama
  22. hjson
  23. # requirements-dev.txt
  24. nose2
  25. flake8
  26. pep8-naming
  27. yapf
  28. ]);
  29. in
  30. with pkgs;
  31. let
  32. avrlibc = pkgsCross.avr.libcCross;
  33. avr_incflags = [
  34. "-isystem ${avrlibc}/avr/include"
  35. "-B${avrlibc}/avr/lib/avr5"
  36. "-L${avrlibc}/avr/lib/avr5"
  37. "-B${avrlibc}/avr/lib/avr35"
  38. "-L${avrlibc}/avr/lib/avr35"
  39. "-B${avrlibc}/avr/lib/avr51"
  40. "-L${avrlibc}/avr/lib/avr51"
  41. ];
  42. in
  43. mkShell {
  44. name = "qmk-firmware";
  45. buildInputs = [ dfu-programmer dfu-util diffutils git pythonEnv ]
  46. ++ lib.optional avr [
  47. pkgsCross.avr.buildPackages.binutils
  48. pkgsCross.avr.buildPackages.gcc8
  49. avrlibc
  50. avrdude
  51. ]
  52. ++ lib.optional arm [ gcc-arm-embedded ]
  53. ++ lib.optional teensy [ teensy-loader-cli ];
  54. AVR_CFLAGS = lib.optional avr avr_incflags;
  55. AVR_ASFLAGS = lib.optional avr avr_incflags;
  56. shellHook = ''
  57. # Prevent the avr-gcc wrapper from picking up host GCC flags
  58. # like -iframework, which is problematic on Darwin
  59. unset NIX_TARGET_CFLAGS_COMPILE
  60. '';
  61. }