34a113c97b192fbe28d963178a4d672fb780e27f
- Author
- Sergey Vlasov <sigprof@gmail.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/shell.nix b/shell.nix
2index 63e5af0525d9064c492c42ff8732dd33510668b1..88822b0b17e8c90ebdc5a17d1aa9285018ca77d2 100644
3--- a/shell.nix
4+++ b/shell.nix
5@@ -1,29 +1,9 @@
6 let
7 # We specify sources via Niv: use "niv update nixpkgs" to update nixpkgs, for example.
8 sources = import ./util/nix/sources.nix { };
9-
10- # `tomlkit` >= 0.8.0 is required to build `jsonschema` >= 4.11.0 (older
11- # version do not support some valid TOML syntax: sdispater/tomlkit#148). The
12- # updated `tomlkit` must be used by `makeRemoveSpecialDependenciesHook`
13- # inside `poetry2nix`, therefore just providing the updated version through
14- # our `nix/pyproject.toml` does not work, and using an overlay is required.
15- pythonOverlay = final: prev: {
16- python3 = prev.python3.override {
17- packageOverrides = self: super: {
18- tomlkit = super.tomlkit.overridePythonAttrs(old: rec {
19- version = "0.11.4";
20- src = super.fetchPypi {
21- inherit (old) pname;
22- inherit version;
23- sha256 = "sha256-MjWpAQ+uVDI+cnw6wG+3IHUv5mNbNCbjedrsYPvUSoM=";
24- };
25- });
26- };
27- };
28- };
29 in
30 # However, if you want to override Niv's inputs, this will let you do that.
31-{ pkgs ? import sources.nixpkgs { overlays = [ pythonOverlay ]; }
32+{ pkgs ? import sources.nixpkgs { }
33 , poetry2nix ? pkgs.callPackage (import sources.poetry2nix) { }
34 , avr ? true
35 , arm ? true
36@@ -49,18 +29,22 @@ let
37 pythonEnv = poetry2nix.mkPoetryEnv {
38 projectDir = ./util/nix;
39 overrides = poetry2nix.overrides.withDefaults (self: super: {
40- pillow = super.pillow.overridePythonAttrs(old: {
41- # Use preConfigure from nixpkgs to fix library detection issues and
42- # impurities which can break the build process; this also requires
43- # adding propagatedBuildInputs and buildInputs from the same source.
44- propagatedBuildInputs = (old.buildInputs or []) ++ pkgs.python3.pkgs.pillow.propagatedBuildInputs;
45- buildInputs = (old.buildInputs or []) ++ pkgs.python3.pkgs.pillow.buildInputs;
46- preConfigure = (old.preConfigure or "") + pkgs.python3.pkgs.pillow.preConfigure;
47- });
48 qmk = super.qmk.overridePythonAttrs(old: {
49 # Allow QMK CLI to run "qmk" as a subprocess (the wrapper changes
50 # $PATH and breaks these invocations).
51 dontWrapPythonPrograms = true;
52+
53+ # Fix "qmk setup" to use the Python interpreter from the environment
54+ # when invoking "qmk doctor" (sys.executable gets its value from
55+ # $NIX_PYTHONEXECUTABLE, which is set by the "qmk" wrapper from the
56+ # Python environment, so "qmk doctor" then runs with the proper
57+ # $NIX_PYTHONPATH too, because sys.executable actually points to
58+ # another wrapper from the same Python environment).
59+ postPatch = ''
60+ substituteInPlace qmk_cli/subcommands/setup.py \
61+ --replace "[Path(sys.argv[0]).as_posix()" \
62+ "[Path(sys.executable).as_posix(), Path(sys.argv[0]).as_posix()"
63+ '';
64 });
65 });
66 };
67@@ -68,7 +52,7 @@ in
68 mkShell {
69 name = "qmk-firmware";
70
71- buildInputs = [ clang-tools dfu-programmer dfu-util diffutils git pythonEnv niv ]
72+ buildInputs = [ clang-tools_11 dfu-programmer dfu-util diffutils git pythonEnv niv ]
73 ++ lib.optional avr [
74 pkgsCross.avr.buildPackages.binutils
75 pkgsCross.avr.buildPackages.gcc8
76diff --git a/util/nix/poetry.lock b/util/nix/poetry.lock
77index dc1b38be843e6f14ef9226f0df7f0944cf0076dd..e9ac91470226497120dbc767336232240e078317 100644
78--- a/util/nix/poetry.lock
79+++ b/util/nix/poetry.lock
80@@ -1,96 +1,97 @@
81+# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand.
82+
83 [[package]]
84 name = "appdirs"
85 version = "1.4.4"
86 description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
87-category = "main"
88 optional = false
89 python-versions = "*"
90+files = [
91+ {file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"},
92+ {file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"},
93+]
94
95 [[package]]
96 name = "argcomplete"
97-version = "2.0.0"
98+version = "3.2.2"
99 description = "Bash tab completion for argparse"
100-category = "main"
101 optional = false
102-python-versions = ">=3.6"
103+python-versions = ">=3.8"
104+files = [
105+ {file = "argcomplete-3.2.2-py3-none-any.whl", hash = "sha256:e44f4e7985883ab3e73a103ef0acd27299dbfe2dfed00142c35d4ddd3005901d"},
106+ {file = "argcomplete-3.2.2.tar.gz", hash = "sha256:f3e49e8ea59b4026ee29548e24488af46e30c9de57d48638e24f54a1ea1000a2"},
107+]
108
109 [package.extras]
110-test = ["wheel", "pexpect", "flake8", "coverage"]
111-
112-[[package]]
113-name = "atomicwrites"
114-version = "1.4.1"
115-description = "Atomic file writes."
116-category = "dev"
117-optional = false
118-python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
119+test = ["coverage", "mypy", "pexpect", "ruff", "wheel"]
120
121 [[package]]
122 name = "attrs"
123-version = "22.1.0"
124+version = "23.2.0"
125 description = "Classes Without Boilerplate"
126-category = "main"
127 optional = false
128-python-versions = ">=3.5"
129+python-versions = ">=3.7"
130+files = [
131+ {file = "attrs-23.2.0-py3-none-any.whl", hash = "sha256:99b87a485a5820b23b879f04c2305b44b951b502fd64be915879d77a7e8fc6f1"},
132+ {file = "attrs-23.2.0.tar.gz", hash = "sha256:935dc3b529c262f6cf76e50877d35a4bd3c1de194fd41f47a2b7ae8f19971f30"},
133+]
134
135 [package.extras]
136-tests_no_zope = ["cloudpickle", "pytest-mypy-plugins", "mypy (>=0.900,!=0.940)", "pytest (>=4.3.0)", "pympler", "hypothesis", "coverage[toml] (>=5.0.2)"]
137-tests = ["cloudpickle", "zope.interface", "pytest-mypy-plugins", "mypy (>=0.900,!=0.940)", "pytest (>=4.3.0)", "pympler", "hypothesis", "coverage[toml] (>=5.0.2)"]
138-docs = ["sphinx-notfound-page", "zope.interface", "sphinx", "furo"]
139-dev = ["cloudpickle", "pre-commit", "sphinx-notfound-page", "sphinx", "furo", "zope.interface", "pytest-mypy-plugins", "mypy (>=0.900,!=0.940)", "pytest (>=4.3.0)", "pympler", "hypothesis", "coverage[toml] (>=5.0.2)"]
140+cov = ["attrs[tests]", "coverage[toml] (>=5.3)"]
141+dev = ["attrs[tests]", "pre-commit"]
142+docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier", "zope-interface"]
143+tests = ["attrs[tests-no-zope]", "zope-interface"]
144+tests-mypy = ["mypy (>=1.6)", "pytest-mypy-plugins"]
145+tests-no-zope = ["attrs[tests-mypy]", "cloudpickle", "hypothesis", "pympler", "pytest (>=4.3.0)", "pytest-xdist[psutil]"]
146
147 [[package]]
148 name = "colorama"
149-version = "0.4.5"
150+version = "0.4.6"
151 description = "Cross-platform colored terminal text."
152-category = "main"
153 optional = false
154-python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
155+python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
156+files = [
157+ {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
158+ {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
159+]
160
161 [[package]]
162 name = "dotty-dict"
163 version = "1.3.1"
164 description = "Dictionary wrapper for quick access to deeply nested keys."
165-category = "main"
166 optional = false
167 python-versions = ">=3.5,<4.0"
168-
169-[[package]]
170-name = "editables"
171-version = "0.3"
172-description = "Editable installations"
173-category = "dev"
174-optional = false
175-python-versions = ">=3.7"
176+files = [
177+ {file = "dotty_dict-1.3.1-py3-none-any.whl", hash = "sha256:5022d234d9922f13aa711b4950372a06a6d64cb6d6db9ba43d0ba133ebfce31f"},
178+ {file = "dotty_dict-1.3.1.tar.gz", hash = "sha256:4b016e03b8ae265539757a53eba24b9bfda506fb94fbce0bee843c6f05541a15"},
179+]
180diff --git a/util/nix/pyproject.toml b/util/nix/pyproject.toml
181index ff484dbe79902e331031f8b40365bfa5809d368c..fa62eb96c011e9b4fbbd91b85d344cff156de26c 100644
182--- a/util/nix/pyproject.toml
183+++ b/util/nix/pyproject.toml
184@@ -8,7 +8,7 @@ description = ""
185 authors = []
186
187 [tool.poetry.dependencies]
188-python = "^3.8"
189+python = "^3.11"
190 appdirs = "*"
191 argcomplete = "*"
192 colorama = "*"
193@@ -34,28 +34,6 @@ pep8-naming = "*"
194 pyflakes = "*"
195 yapf = "*"
196
197-# These dependencies are required by the jsonschema >= 4.11.0 build system, but
198-# are not detected automatically; they are also not present in the used Nixpkgs
199-# snapshot, so need to be obtained through Poetry.
200-hatchling = "*"
201-hatch-vcs = "*"
202-hatch-fancy-pypi-readme = "*"
203-
204-# The `pytest` module in the used Nixpkgs snapshot has an upper bound on the
205-# `pluggy` dependency, which conflicts with the dependency of the `hatchling`
206-# module; upgrading the `pytest` module fixes the conflict.
207-pytest = "*"
208-
209-# Building the `tomli` module, which is in the dependency tree of `hatchling`,
210-# requires a newer `flit-core` module than found in the used Nixpkgs snapshot.
211-flit-core = "*"
212-
213-# Building `dotty-dict` >= 1.3.1 requires the `poetry-core` module, and the
214-# version of that module provided by the used Nixpkgs snapshot cannot be built
215-# on Darwin due to the regex compatibility issue in the old Nixpkgs code
216-# (https://github.com/NixOS/nix/issues/4758).
217-poetry-core = "*"
218-
219 [build-system]
220 requires = ["poetry-core>=1.0.0"]
221 build-backend = "poetry.core.masonry.api"
222diff --git a/util/nix/sources.json b/util/nix/sources.json
223index 8cdb9e49968088b9420106d4aa2a2e2a15d4bdc8..3985f75e033c001c73a1df6ed445bc18934d492d 100644
224--- a/util/nix/sources.json
225+++ b/util/nix/sources.json
226@@ -17,10 +17,10 @@
227 "homepage": "",
228 "owner": "NixOS",
229 "repo": "nixpkgs",
230- "rev": "c0e881852006b132236cbf0301bd1939bb50867e",
231- "sha256": "0fy7z7yxk5n7yslsvx5cyc6h21qwi4bhxf3awhirniszlbvaazy2",
232+ "rev": "98b00b6947a9214381112bdb6f89c25498db4959",
233+ "sha256": "1m6dm144mbm56n9293m26f46bjrklknyr4q4kzvxkiv036ijma98",
234 "type": "tarball",
235- "url": "https://github.com/NixOS/nixpkgs/archive/c0e881852006b132236cbf0301bd1939bb50867e.tar.gz",
236+ "url": "https://github.com/NixOS/nixpkgs/archive/98b00b6947a9214381112bdb6f89c25498db4959.tar.gz",
237 "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
238 },
239 "poetry2nix": {
240@@ -29,10 +29,10 @@
241 "homepage": "",
242 "owner": "nix-community",
243 "repo": "poetry2nix",
244- "rev": "11c0df8e348c0f169cd73a2e3d63f65c92baf666",
245- "sha256": "0i3wbp2p0x6bpj07sqpvkbx4lvjm0irvpmv2bjqx8k02mpjm7dg2",
246+ "rev": "3c92540611f42d3fb2d0d084a6c694cd6544b609",
247+ "sha256": "1jfrangw0xb5b8sdkimc550p3m98zhpb1fayahnr7crg74as4qyq",
248 "type": "tarball",
249- "url": "https://github.com/nix-community/poetry2nix/archive/11c0df8e348c0f169cd73a2e3d63f65c92baf666.tar.gz",
250+ "url": "https://github.com/nix-community/poetry2nix/archive/3c92540611f42d3fb2d0d084a6c694cd6544b609.tar.gz",
251 "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
252 }
253 }
254diff --git a/util/nix/sources.nix b/util/nix/sources.nix
255index 1938409dddb0b57d9f298046cf51875060283df2..fe3dadf7ebb1da68bff868e5ca95a2eaae1ddc9c 100644
256--- a/util/nix/sources.nix
257+++ b/util/nix/sources.nix
258@@ -10,29 +10,50 @@ let
259 let
260 name' = sanitizeName name + "-src";
261 in
262- if spec.builtin or true then
263- builtins_fetchurl { inherit (spec) url sha256; name = name'; }
264- else
265- pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
266+ if spec.builtin or true then
267+ builtins_fetchurl { inherit (spec) url sha256; name = name'; }
268+ else
269+ pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
270
271 fetch_tarball = pkgs: name: spec:
272 let
273 name' = sanitizeName name + "-src";
274 in
275- if spec.builtin or true then
276- builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
277- else
278- pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
279+ if spec.builtin or true then
280+ builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
281+ else
282+ pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
283
284 fetch_git = name: spec:
285 let
286 ref =
287- if spec ? ref then spec.ref else
288+ spec.ref or (
289 if spec ? branch then "refs/heads/${spec.branch}" else
290- if spec ? tag then "refs/tags/${spec.tag}" else
291- abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!";
292+ if spec ? tag then "refs/tags/${spec.tag}" else
293+ abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!"
294+ );
295+ submodules = spec.submodules or false;
296+ submoduleArg =
297+ let
298+ nixSupportsSubmodules = builtins.compareVersions builtins.nixVersion "2.4" >= 0;
299+ emptyArgWithWarning =
300+ if submodules
301+ then
302+ builtins.trace
303+ (
304+ "The niv input \"${name}\" uses submodules "
305+ + "but your nix's (${builtins.nixVersion}) builtins.fetchGit "
306+ + "does not support them"
307+ )
308+ { }
309+ else { };
310+ in
311+ if nixSupportsSubmodules
312+ then { inherit submodules; }
313+ else emptyArgWithWarning;
314 in
315- builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; };
316+ builtins.fetchGit
317+ ({ url = spec.repo; inherit (spec) rev; inherit ref; } // submoduleArg);
318
319 fetch_local = spec: spec.path;
320
321@@ -66,16 +87,16 @@ let
322 hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
323 hasThisAsNixpkgsPath = <nixpkgs> == ./.;
324 in
325- if builtins.hasAttr "nixpkgs" sources
326- then sourcesNixpkgs
327- else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
328- import <nixpkgs> {}
329- else
330- abort
331- ''
332- Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
333- add a package called "nixpkgs" to your sources.json.
334- '';
335+ if builtins.hasAttr "nixpkgs" sources
336+ then sourcesNixpkgs
337+ else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
338+ import <nixpkgs> { }
339+ else
340+ abort
341+ ''
342+ Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
343+ add a package called "nixpkgs" to your sources.json.
344+ '';
345
346 # The actual fetching function.
347 fetch = pkgs: name: spec:
348@@ -95,13 +116,13 @@ let
349 # the path directly as opposed to the fetched source.
350 replace = name: drv:
351 let
352- saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name;
353+ saneName = stringAsChars (c: if (builtins.match "[a-zA-Z0-9]" c) == null then "_" else c) name;
354 ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
355 in
356- if ersatz == "" then drv else
357- # this turns the string into an actual Nix path (for both absolute and