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.

60 lines
1.9 KiB

Update the nix-shell environment (#13316) * Nix: Allow calls to `bin/qmk` even when the build was started by `qmk` The `$PATH` modifications performed by the Nix wrapper for the `qmk` executable prevent `bin/qmk` from working properly (the changed `$PATH` contains a wrong `python3` executable which does not have the needed Python modules in its module path). As a workaround, disable the generation of that wrapper for the `qmk` Python package (there is yet another wrapper generated while building the Python environment, which would still set the Python module path properly when running `qmk`). Although `bin/qmk` is officially deprecated, QMK CLI still invokes it in some cases (at least `qmk doctor` and `qmk pytest`), therefore keeping these invocations working is useful. * Nix: Update `util/nix/pyproject.toml` to match `requirements*.txt` Update the Python dependency information used by Poetry to match the current state of the qmk_firmware code. * Nix: Bump QMK CLI dependency to 1.0.0; bump other Python deps Update Python dependencies for nix-shell to the most recent releases: - dotty-dict: 1.3.0 -> no longer used - milc: 1.4.2 -> 1.6.2 - pep8-naming: 0.11.1 -> 0.12.1 - pygments: 2.9.0 -> 2.10.0 - pyrsistent: 0.17.3 -> 0.18.0 - pyusb: 1.1.1 -> 1.2.1 - setuptools-scm: 6.0.1 -> no longer used - qmk: 0.1.0 -> 1.0.0 - qmk-dotty-dict: not used -> 1.3.0.post1 - yapf: 0.30.0 -> 0.31.0 Note to self: The command to update Python dependencies changed to: ( cd util/nix && nix run 'nixpkgs#poetry' -- update --lock )
2 years ago
Update the nix-shell environment (#13316) * Nix: Allow calls to `bin/qmk` even when the build was started by `qmk` The `$PATH` modifications performed by the Nix wrapper for the `qmk` executable prevent `bin/qmk` from working properly (the changed `$PATH` contains a wrong `python3` executable which does not have the needed Python modules in its module path). As a workaround, disable the generation of that wrapper for the `qmk` Python package (there is yet another wrapper generated while building the Python environment, which would still set the Python module path properly when running `qmk`). Although `bin/qmk` is officially deprecated, QMK CLI still invokes it in some cases (at least `qmk doctor` and `qmk pytest`), therefore keeping these invocations working is useful. * Nix: Update `util/nix/pyproject.toml` to match `requirements*.txt` Update the Python dependency information used by Poetry to match the current state of the qmk_firmware code. * Nix: Bump QMK CLI dependency to 1.0.0; bump other Python deps Update Python dependencies for nix-shell to the most recent releases: - dotty-dict: 1.3.0 -> no longer used - milc: 1.4.2 -> 1.6.2 - pep8-naming: 0.11.1 -> 0.12.1 - pygments: 2.9.0 -> 2.10.0 - pyrsistent: 0.17.3 -> 0.18.0 - pyusb: 1.1.1 -> 1.2.1 - setuptools-scm: 6.0.1 -> no longer used - qmk: 0.1.0 -> 1.0.0 - qmk-dotty-dict: not used -> 1.3.0.post1 - yapf: 0.30.0 -> 0.31.0 Note to self: The command to update Python dependencies changed to: ( cd util/nix && nix run 'nixpkgs#poetry' -- update --lock )
2 years ago
3 years ago
  1. let
  2. # We specify sources via Niv: use "niv update nixpkgs" to update nixpkgs, for example.
  3. sources = import ./util/nix/sources.nix { };
  4. in
  5. # However, if you want to override Niv's inputs, this will let you do that.
  6. { pkgs ? import sources.nixpkgs { }
  7. , poetry2nix ? pkgs.callPackage (import sources.poetry2nix) { }
  8. , avr ? true
  9. , arm ? true
  10. , teensy ? true }:
  11. with pkgs;
  12. let
  13. avrlibc = pkgsCross.avr.libcCross;
  14. avr_incflags = [
  15. "-isystem ${avrlibc}/avr/include"
  16. "-B${avrlibc}/avr/lib/avr5"
  17. "-L${avrlibc}/avr/lib/avr5"
  18. "-B${avrlibc}/avr/lib/avr35"
  19. "-L${avrlibc}/avr/lib/avr35"
  20. "-B${avrlibc}/avr/lib/avr51"
  21. "-L${avrlibc}/avr/lib/avr51"
  22. ];
  23. # Builds the python env based on nix/pyproject.toml and
  24. # nix/poetry.lock Use the "poetry update --lock", "poetry add
  25. # --lock" etc. in the nix folder to adjust the contents of those
  26. # files if the requirements*.txt files change
  27. pythonEnv = poetry2nix.mkPoetryEnv {
  28. projectDir = ./util/nix;
  29. overrides = poetry2nix.overrides.withDefaults (self: super: {
  30. qmk = super.qmk.overridePythonAttrs(old: {
  31. # Allow QMK CLI to run "qmk" as a subprocess (the wrapper changes
  32. # $PATH and breaks these invocations).
  33. dontWrapPythonPrograms = true;
  34. });
  35. });
  36. };
  37. in
  38. mkShell {
  39. name = "qmk-firmware";
  40. buildInputs = [ clang-tools dfu-programmer dfu-util diffutils git pythonEnv poetry niv ]
  41. ++ lib.optional avr [
  42. pkgsCross.avr.buildPackages.binutils
  43. pkgsCross.avr.buildPackages.gcc8
  44. avrlibc
  45. avrdude
  46. ]
  47. ++ lib.optional arm [ gcc-arm-embedded ]
  48. ++ lib.optional teensy [ teensy-loader-cli ];
  49. AVR_CFLAGS = lib.optional avr avr_incflags;
  50. AVR_ASFLAGS = lib.optional avr avr_incflags;
  51. shellHook = ''
  52. # Prevent the avr-gcc wrapper from picking up host GCC flags
  53. # like -iframework, which is problematic on Darwin
  54. unset NIX_CFLAGS_COMPILE_FOR_TARGET
  55. '';
  56. }