Skip to content

Commit 34a113c

Browse files
authored
Nix shell updates (Nixpkgs 2024-02-23, QMK CLI 1.1.5) (qmk#23143)
1 parent 65a04ea commit 34a113c

File tree

5 files changed

+524
-644
lines changed

5 files changed

+524
-644
lines changed

Diff for: shell.nix

+14-30
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,9 @@
11
let
22
# We specify sources via Niv: use "niv update nixpkgs" to update nixpkgs, for example.
33
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-
};
244
in
255
# 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 { }
277
, poetry2nix ? pkgs.callPackage (import sources.poetry2nix) { }
288
, avr ? true
299
, arm ? true
@@ -49,26 +29,30 @@ let
4929
pythonEnv = poetry2nix.mkPoetryEnv {
5030
projectDir = ./util/nix;
5131
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-
});
6032
qmk = super.qmk.overridePythonAttrs(old: {
6133
# Allow QMK CLI to run "qmk" as a subprocess (the wrapper changes
6234
# $PATH and breaks these invocations).
6335
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+
'';
6448
});
6549
});
6650
};
6751
in
6852
mkShell {
6953
name = "qmk-firmware";
7054

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 ]
7256
++ lib.optional avr [
7357
pkgsCross.avr.buildPackages.binutils
7458
pkgsCross.avr.buildPackages.gcc8

0 commit comments

Comments
 (0)