From 1283689d84e60104bff3079d8ca4351f9275a1d3 Mon Sep 17 00:00:00 2001 From: maulanasdqn Date: Wed, 21 Jan 2026 18:45:45 +0700 Subject: [PATCH] fix(nix): use script command to create pseudo-terminal for Nx This provides a pty that satisfies Nx's terminal requirements, preventing the raw terminal mode crash in sandboxed builds. --- nix/mkViteApp.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nix/mkViteApp.nix b/nix/mkViteApp.nix index 8977905..4c254a0 100644 --- a/nix/mkViteApp.nix +++ b/nix/mkViteApp.nix @@ -14,6 +14,7 @@ pkgs.buildNpmPackage { nativeBuildInputs = with pkgs; [ nodejs_22 nodePackages.npm + util-linux # For script command to create pseudo-terminal ]; buildPhase = '' @@ -27,10 +28,9 @@ pkgs.buildNpmPackage { export NX_TASKS_RUNNER_DYNAMIC_OUTPUT=false export NX_NATIVE=false ${pkgs.lib.concatStringsSep "\n" (pkgs.lib.mapAttrsToList (k: v: "export ${k}=\"${v}\"") envVars)} - # Run nx build, ignore terminal crash after successful build - # Run in background and wait to handle SIGABRT from Nx terminal crash - ./node_modules/.bin/nx build ${name} --output-style=static & - wait $! || true + # Run nx build with pseudo-terminal to prevent terminal access errors + # Use script to create a pty, preventing Nx from crashing on raw terminal mode + script -q -c "./node_modules/.bin/nx build ${name} --output-style=static" /dev/null || true # Verify the build output exists test -d dist/apps/${name} runHook postBuild