Split runtime node_modules into reusable layers

- Add shared installFlags support to the common Bun node_modules builder
- Factor base and desktop overlay node_modules derivations for reuse
- Reuse the new runtime node_modules outputs in desktop and server builds
This commit is contained in:
2026-04-27 12:45:00 +03:00
parent 3fbafbc0ea
commit 9e96208724
4 changed files with 127 additions and 6 deletions
+5
View File
@@ -17,6 +17,9 @@
renderBunFilters = filters:
lib.concatMapStringsSep "\n" (filter: " --filter ${filter} \\") filters;
renderBunInstallFlags = flags:
lib.concatMapStringsSep "\n" (flag: " ${flag} \\") flags;
in {
inherit workspacePreparePatched;
@@ -29,6 +32,7 @@ in {
src,
outputHash,
filters,
installFlags ? [],
extraNativeBuildInputs ? [],
impureEnvVars ? [],
extraEnv ? "",
@@ -68,6 +72,7 @@ in {
--backend=copyfile \
--linker=hoisted \
--no-progress \
${renderBunInstallFlags installFlags}
${renderBunFilters filters}
bun --bun ${./scripts/canonicalize-node-modules.ts}