Improve readonly-paths-from-var performance

This commit is contained in:
Mathias Sven 2026-07-08 14:07:59 +01:00 • committed by boyreau
commit 6c68b722cc

View file

@ -31,11 +31,10 @@ in
assert lib.isValidPosixName var; assert lib.isValidPosixName var;
include-once "readonly-paths-from-var-${var}" (add-runtime '' include-once "readonly-paths-from-var-${var}" (add-runtime ''
IFS=${lib.escapeShellArg separator} read -ra DIRS <<< "''${${var}-}" IFS=${lib.escapeShellArg separator} read -ra DIRS <<< "''${${var}-}"
for DIR in "''${DIRS[@]}"; do if ((''${#DIRS[@]})); then
if [ -e "$DIR" ]; then while IFS= read -r -d ''' P; do
P="$(realpath "$DIR")"
RUNTIME_ARGS+=(--ro-bind "$P" "$P") RUNTIME_ARGS+=(--ro-bind "$P" "$P")
fi done < <(realpath -ezq -- "''${DIRS[@]}")
done fi
''); '');
} }