File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 482482
483483 # so NSS can look up usernames
484484 "${ pkgs . glibc } /lib/libnss_files.so.2"
485+
486+ # Resolving sysroot symlinks without code exec
487+ "${ pkgs . chroot-realpath } /bin/chroot-realpath"
485488 ] ++ optionals cfg . package . withCryptsetup [
486489 # fido2 support
487490 "${ cfg . package } /lib/cryptsetup/libcryptsetup-token-systemd-fido2.so"
522525
523526 script = /* bash */ ''
524527 set -uo pipefail
525- export PATH="/bin:${ cfg . package . util-linux } /bin"
528+ export PATH="/bin:${ cfg . package . util-linux } /bin: ${ pkgs . chroot-realpath } /bin "
526529
527530 # Figure out what closure to boot
528531 closure=
543546
544547 # Resolve symlinks in the init parameter. We need this for some boot loaders
545548 # (e.g. boot.loader.generationsDir).
546- closure="$(chroot /sysroot ${ pkgs . coreutils } /bin/realpath "$closure")"
549+ closure="$(chroot-realpath /sysroot "$closure")"
547550
548551 # Assume the directory containing the init script is the closure.
549552 closure="$(dirname "$closure")"
Original file line number Diff line number Diff line change 139139
140140 closure="$(realpath /nixos-closure)"
141141
142- metadata_image="$(chroot /sysroot ${ lib . getExe' pkgs . coreutils " realpath" } "$closure/etc-metadata-image")"
142+ metadata_image="$(${ pkgs . chroot- realpath} /bin/chroot-realpath /sysroot "$closure/etc-metadata-image")"
143143 ln -s "/sysroot$metadata_image" /etc-metadata-image
144144
145- basedir="$(chroot /sysroot ${ lib . getExe' pkgs . coreutils " realpath" } "$closure/etc-basedir")"
145+ basedir="$(${ pkgs . chroot- realpath} /bin/chroot-realpath /sysroot "$closure/etc-basedir")"
146146 ln -s "/sysroot$basedir" /etc-basedir
147147 '' ;
148148 } ;
You can’t perform that action at this time.
0 commit comments