disko-install: resolve symlinks in mount point path

Nix refuses to operate when the store path or its parent directories
contain symlinks. On some systems /mnt can be a symlink, causing
disko-install to fail with:

  error: the path '"/mnt"' is a symlink; this is not allowed for the
  Nix store and its parent directories

Use realpath to resolve symlinks before passing the mount point to
nix-store and nixos-install commands.
This commit is contained in:
Jörg Thalheim
2025-12-19 13:25:02 +00:00
committed by Jörg Thalheim
parent 7194cfe5b7
commit 6b172212b6
2 changed files with 11 additions and 5 deletions
+3
View File
@@ -224,6 +224,9 @@ main() {
maybeRun mkdir -p "${mountPoint}"
maybeRun chmod 755 "${mountPoint}" # bcachefs wants 755
# Resolve symlinks in mountPoint path to satisfy nix-store requirements
# (nix refuses symlinks in store path hierarchy)
mountPoint=$(realpath "${mountPoint}")
# shellcheck disable=SC2064
if [[ -z ${dry_run-} ]]; then
trap cleanupMountPoint EXIT