|
1 | 1 | let
|
2 | 2 | # We specify sources via Niv: use "niv update nixpkgs" to update nixpkgs, for example.
|
3 | 3 | sources = import ./util/nix/sources.nix { };
|
4 |
| - |
5 |
| - # `tomlkit` >= 0.8.0 is required to build `jsonschema` >= 4.11.0 (older |
6 |
| - # version do not support some valid TOML syntax: sdispater/tomlkit#148). The |
7 |
| - # updated `tomlkit` must be used by `makeRemoveSpecialDependenciesHook` |
8 |
| - # inside `poetry2nix`, therefore just providing the updated version through |
9 |
| - # our `nix/pyproject.toml` does not work, and using an overlay is required. |
10 |
| - pythonOverlay = final: prev: { |
11 |
| - python3 = prev.python3.override { |
12 |
| - packageOverrides = self: super: { |
13 |
| - tomlkit = super.tomlkit.overridePythonAttrs(old: rec { |
14 |
| - version = "0.11.4"; |
15 |
| - src = super.fetchPypi { |
16 |
| - inherit (old) pname; |
17 |
| - inherit version; |
18 |
| - sha256 = "sha256-MjWpAQ+uVDI+cnw6wG+3IHUv5mNbNCbjedrsYPvUSoM="; |
19 |
| - }; |
20 |
| - }); |
21 |
| - }; |
22 |
| - }; |
23 |
| - }; |
24 | 4 | in
|
25 | 5 | # However, if you want to override Niv's inputs, this will let you do that.
|
26 |
| -{ pkgs ? import sources.nixpkgs { overlays = [ pythonOverlay ]; } |
| 6 | +{ pkgs ? import sources.nixpkgs { } |
27 | 7 | , poetry2nix ? pkgs.callPackage (import sources.poetry2nix) { }
|
28 | 8 | , avr ? true
|
29 | 9 | , arm ? true
|
|
49 | 29 | pythonEnv = poetry2nix.mkPoetryEnv {
|
50 | 30 | projectDir = ./util/nix;
|
51 | 31 | overrides = poetry2nix.overrides.withDefaults (self: super: {
|
52 |
| - pillow = super.pillow.overridePythonAttrs(old: { |
53 |
| - # Use preConfigure from nixpkgs to fix library detection issues and |
54 |
| - # impurities which can break the build process; this also requires |
55 |
| - # adding propagatedBuildInputs and buildInputs from the same source. |
56 |
| - propagatedBuildInputs = (old.buildInputs or []) ++ pkgs.python3.pkgs.pillow.propagatedBuildInputs; |
57 |
| - buildInputs = (old.buildInputs or []) ++ pkgs.python3.pkgs.pillow.buildInputs; |
58 |
| - preConfigure = (old.preConfigure or "") + pkgs.python3.pkgs.pillow.preConfigure; |
59 |
| - }); |
60 | 32 | qmk = super.qmk.overridePythonAttrs(old: {
|
61 | 33 | # Allow QMK CLI to run "qmk" as a subprocess (the wrapper changes
|
62 | 34 | # $PATH and breaks these invocations).
|
63 | 35 | dontWrapPythonPrograms = true;
|
| 36 | + |
| 37 | + # Fix "qmk setup" to use the Python interpreter from the environment |
| 38 | + # when invoking "qmk doctor" (sys.executable gets its value from |
| 39 | + # $NIX_PYTHONEXECUTABLE, which is set by the "qmk" wrapper from the |
| 40 | + # Python environment, so "qmk doctor" then runs with the proper |
| 41 | + # $NIX_PYTHONPATH too, because sys.executable actually points to |
| 42 | + # another wrapper from the same Python environment). |
| 43 | + postPatch = '' |
| 44 | + substituteInPlace qmk_cli/subcommands/setup.py \ |
| 45 | + --replace "[Path(sys.argv[0]).as_posix()" \ |
| 46 | + "[Path(sys.executable).as_posix(), Path(sys.argv[0]).as_posix()" |
| 47 | + ''; |
64 | 48 | });
|
65 | 49 | });
|
66 | 50 | };
|
67 | 51 | in
|
68 | 52 | mkShell {
|
69 | 53 | name = "qmk-firmware";
|
70 | 54 |
|
71 |
| - buildInputs = [ clang-tools dfu-programmer dfu-util diffutils git pythonEnv niv ] |
| 55 | + buildInputs = [ clang-tools_11 dfu-programmer dfu-util diffutils git pythonEnv niv ] |
72 | 56 | ++ lib.optional avr [
|
73 | 57 | pkgsCross.avr.buildPackages.binutils
|
74 | 58 | pkgsCross.avr.buildPackages.gcc8
|
|
0 commit comments