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
+58
View File
@@ -0,0 +1,58 @@
{
lib,
pkgs,
src,
}: let
common = pkgs.callPackage ./common.nix {};
t3codeNodeModulesBase = common.mkNodeModules {
pname = "t3code";
version = "base";
inherit src;
outputHash = "sha256-eXNOHRuNv9XFhXmsFtkunZswtRPd8gzJB1Jdw2DxYZY=";
filters = [
"."
"./apps/server"
"./apps/web"
"./packages/client-runtime"
"./packages/contracts"
"./packages/effect-acp"
"./packages/effect-codex-app-server"
"./packages/shared"
];
};
t3codeNodeModulesDesktopOverlay = common.mkNodeModules {
pname = "t3code-desktop-overlay";
version = "overlay";
inherit src;
outputHash = "sha256-P6hlfpIZOLmkdXn99e0WC1CHAf7SD4CjouVwvAYo0+w=";
filters = [
"."
"./apps/desktop"
];
impureEnvVars =
lib.fetchers.proxyImpureEnvVars
++ [
"GIT_PROXY_COMMAND"
"SOCKS_SERVER"
];
extraNativeBuildInputs = [
pkgs.gcc
pkgs.gnumake
pkgs.pkg-config
pkgs.python3
];
extraEnv = ''
export ELECTRON_SKIP_BINARY_DOWNLOAD=1
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
export npm_config_build_from_source=true
'';
};
in {
inherit
t3codeNodeModulesBase
t3codeNodeModulesDesktopOverlay
;
}