diff --git a/lib/images/windows/helpers/customizeImage.nix b/lib/images/windows/helpers/customizeImage.nix index a1e7be8..51b4d30 100644 --- a/lib/images/windows/helpers/customizeImage.nix +++ b/lib/images/windows/helpers/customizeImage.nix @@ -99,7 +99,11 @@ VMIX_DISPLAY="-nographic" ${lib.optionalString (vncDisplay != null) ''VMIX_DISPLAY="-vnc ${vncDisplay}"''} ${lib.optionalString (vncDisplay == null) '' - VMIX_DF=$(ls -t /tmp/.vmix-display-* 2>/dev/null | head -1) + # find, not a glob: under nullglob a non-matching /tmp/.vmix-display-* + # disappears entirely, leaving `ls -t` to list the build directory and + # hand back nix's own env-vars dump. Exporting that as DISPLAY bloats + # the environment until every exec dies with E2BIG. + VMIX_DF=$(find /tmp -maxdepth 1 -type f -name '.vmix-display-*' -printf '%T@ %p\n' 2>/dev/null | sort -rn | head -1 | cut -d' ' -f2-) if [ -n "$VMIX_DF" ]; then export DISPLAY=$(sed -n '1p' "$VMIX_DF") export XAUTHORITY=$(sed -n '2p' "$VMIX_DF") diff --git a/lib/images/windows/helpers/makeImage.nix b/lib/images/windows/helpers/makeImage.nix index 983c6fb..0f16750 100644 --- a/lib/images/windows/helpers/makeImage.nix +++ b/lib/images/windows/helpers/makeImage.nix @@ -49,7 +49,11 @@ let VMIX_DISPLAY="-nographic" ${lib.optionalString (displayArg != null) ''VMIX_DISPLAY="${displayArg}"''} ${lib.optionalString (displayArg == null) '' - VMIX_DF=$(ls -t /tmp/.vmix-display-* 2>/dev/null | head -1) + # find, not a glob: under nullglob a non-matching /tmp/.vmix-display-* + # disappears entirely, leaving `ls -t` to list the build directory and + # hand back nix's own env-vars dump. Exporting that as DISPLAY bloats the + # environment until every exec dies with E2BIG. + VMIX_DF=$(find /tmp -maxdepth 1 -type f -name '.vmix-display-*' -printf '%T@ %p\n' 2>/dev/null | sort -rn | head -1 | cut -d' ' -f2-) if [ -n "$VMIX_DF" ]; then export DISPLAY=$(sed -n '1p' "$VMIX_DF") export XAUTHORITY=$(sed -n '2p' "$VMIX_DF")