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.
This commit is contained in:
+4
-4
@@ -14,6 +14,7 @@ pkgs.buildNpmPackage {
|
|||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
nodejs_22
|
nodejs_22
|
||||||
nodePackages.npm
|
nodePackages.npm
|
||||||
|
util-linux # For script command to create pseudo-terminal
|
||||||
];
|
];
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
@@ -27,10 +28,9 @@ pkgs.buildNpmPackage {
|
|||||||
export NX_TASKS_RUNNER_DYNAMIC_OUTPUT=false
|
export NX_TASKS_RUNNER_DYNAMIC_OUTPUT=false
|
||||||
export NX_NATIVE=false
|
export NX_NATIVE=false
|
||||||
${pkgs.lib.concatStringsSep "\n" (pkgs.lib.mapAttrsToList (k: v: "export ${k}=\"${v}\"") envVars)}
|
${pkgs.lib.concatStringsSep "\n" (pkgs.lib.mapAttrsToList (k: v: "export ${k}=\"${v}\"") envVars)}
|
||||||
# Run nx build, ignore terminal crash after successful build
|
# Run nx build with pseudo-terminal to prevent terminal access errors
|
||||||
# Run in background and wait to handle SIGABRT from Nx terminal crash
|
# Use script to create a pty, preventing Nx from crashing on raw terminal mode
|
||||||
./node_modules/.bin/nx build ${name} --output-style=static &
|
script -q -c "./node_modules/.bin/nx build ${name} --output-style=static" /dev/null || true
|
||||||
wait $! || true
|
|
||||||
# Verify the build output exists
|
# Verify the build output exists
|
||||||
test -d dist/apps/${name}
|
test -d dist/apps/${name}
|
||||||
runHook postBuild
|
runHook postBuild
|
||||||
|
|||||||
Reference in New Issue
Block a user