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.

72 lines
2.5 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
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. # Fix "qmk setup" to use the Python interpreter from the environment
  35. # when invoking "qmk doctor" (sys.executable gets its value from
  36. # $NIX_PYTHONEXECUTABLE, which is set by the "qmk" wrapper from the
  37. # Python environment, so "qmk doctor" then runs with the proper
  38. # $NIX_PYTHONPATH too, because sys.executable actually points to
  39. # another wrapper from the same Python environment).
  40. postPatch = ''
  41. substituteInPlace qmk_cli/subcommands/setup.py \
  42. --replace "[Path(sys.argv[0]).as_posix()" \
  43. "[Path(sys.executable).as_posix(), Path(sys.argv[0]).as_posix()"
  44. '';
  45. });
  46. });
  47. };
  48. in
  49. mkShell {
  50. name = "qmk-firmware";
  51. buildInputs = [ clang-tools_11 dfu-programmer dfu-util diffutils git pythonEnv niv ]
  52. ++ lib.optional avr [
  53. pkgsCross.avr.buildPackages.binutils
  54. pkgsCross.avr.buildPackages.gcc8
  55. avrlibc
  56. avrdude
  57. ]
  58. ++ lib.optional arm [ gcc-arm-embedded ]
  59. ++ lib.optional teensy [ teensy-loader-cli ];
  60. AVR_CFLAGS = lib.optional avr avr_incflags;
  61. AVR_ASFLAGS = lib.optional avr avr_incflags;
  62. shellHook = ''
  63. # Prevent the avr-gcc wrapper from picking up host GCC flags
  64. # like -iframework, which is problematic on Darwin
  65. unset NIX_CFLAGS_COMPILE_FOR_TARGET
  66. '';
  67. }