fix: pass NIXPACKS_NODE_VERSION as a CLI flag, not a process env var
All checks were successful
CI / test (push) Successful in 33s

nixpacks doesn't read NIXPACKS_* config from the process environment
at all, only from -e/--env on its own CLI — the "fix" from the
previous commit was silently a no-op (nixpacks plan still showed
nodejs_18 for a repo pinned to 20 that way). Caught because the first
real container built with it still crashed the same way.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 04:51:31 +02:00
parent 9f88769922
commit 021fa2220e
2 changed files with 14 additions and 4 deletions

View File

@@ -61,14 +61,17 @@ export function runNixpacksBuild(slug: string, repoDir: string, imageTag: string
fs.mkdirSync(path.dirname(logPath), { recursive: true });
const logStream = fs.createWriteStream(logPath, { flags: "a" });
const env = { ...process.env };
const args = ["build", repoDir, "--name", imageTag];
const nodeVersion = detectNodeVersion(repoDir);
if (nodeVersion) {
env.NIXPACKS_NODE_VERSION = nodeVersion;
// nixpacks does NOT read NIXPACKS_* config from the process environment — only from
// its own `-e`/`--env` CLI flag (confirmed: setting it as a plain env var is silently
// ignored, `nixpacks plan` still showed nodejs_18 for a repo pinned to 20 that way).
args.push("-e", `NIXPACKS_NODE_VERSION=${nodeVersion}`);
logStream.write(`[remote-mcp-manager] pinning NIXPACKS_NODE_VERSION=${nodeVersion}\n`);
}
const child = spawn("nixpacks", ["build", repoDir, "--name", imageTag], { env });
const child = spawn("nixpacks", args);
child.stdout.pipe(logStream, { end: false });
child.stderr.pipe(logStream, { end: false });