From d7d8928f088aae6af5674bb80e916052a64bcb4b Mon Sep 17 00:00:00 2001 From: marcothedood Date: Wed, 23 Sep 2026 11:03:48 +0200 Subject: [PATCH] fix(nix): pin dev shell to nodejs_24 and add python3 better-sqlite3 has a binding.gyp and no install script, so npm runs `node-gyp rebuild` for it. macOS /usr/bin/python3 is an Xcode CLT stub that cannot exec, node-gyp aborts with "Could not find any Python installation to use", and npm silently prunes the package because it is an optionalDependency. `nix develop` then ends on the postinstall.mjs CRITICAL banner with no working SQLite driver. nodejs_22 also ships npm 10, which rewrites package-lock.json on every install: it drops the npm 11 `libc` fields and downgrades undici 7.29.1 to 6.28.1 (221 deletions). nodejs_24 ships npm 11, which does not run unapproved install scripts, so the bundled prebuilds/darwin-arm64.node is used and the lockfile stays byte-identical. python3 is kept in the shell for any from-source native build. engines allow >=24.0.0 <27. --- flake.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 34317a499e8..c1940630023 100644 --- a/flake.nix +++ b/flake.nix @@ -10,12 +10,21 @@ flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; - nodejs = pkgs.nodejs_22; + # nodejs_22 ships npm 10, which (a) rewrites package-lock.json on every + # install (drops the npm 11 `libc` fields, downgrades undici 7 -> 6) and + # (b) runs node-gyp for better-sqlite3 -> fails without Python -> npm + # silently prunes it, since it is an optionalDependency. + # node 24 ships npm 11: lockfile stays byte-identical and the bundled + # better-sqlite3 prebuild is used instead of a source build. + nodejs = pkgs.nodejs_24; in { devShells.default = pkgs.mkShell { buildInputs = [ nodejs + # Real Python for node-gyp: macOS /usr/bin/python3 is an Xcode CLT + # stub that cannot exec, so any from-source native build fails. + pkgs.python3 ]; shellHook = ''