install: improve output and error handling

This commit is contained in:
Daiderd Jordan 2020-03-07 12:01:40 +01:00
parent caface1980
commit 04f597c3f4
No known key found for this signature in database
GPG key ID: D02435D05B810C96
3 changed files with 20 additions and 7 deletions

View file

@ -199,6 +199,7 @@ nix
</screen>
<screen>
alice$ /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -B
alice$ sudo diskutil apfs addVolume diskX APFS 'Nix Store' -mountpoint /nix
alice$ mount
/dev/disk1s6 on /nix (apfs, local, journaled)
@ -231,7 +232,7 @@ LABEL=Nix\040Store /nix apfs rw
</para>
<screen>
diskutil apfs enableFileVault /nix -user disk
alice$ diskutil apfs enableFileVault /nix -user disk
</screen>
</listitem>

View file

@ -73,12 +73,22 @@ main() {
if ! test_synthetic_conf; then
echo "Configuring /etc/synthetic.conf..." >&2
echo nix | sudo tee /etc/synthetic.conf
/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -B
if ! test_synthetic_conf; then
echo "error: failed to configure synthetic.conf" >&2
exit 1
fi
fi
if ! test_nix; then
echo "Creating mountpoint for /nix..." >&2
sudo mkdir /nix
/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -B || true
if ! test_nix; then
sudo mkdir -p /nix 2>/dev/null || true
fi
if ! test_nix; then
echo "error: failed to bootstrap /nix, a reboot might be required" >&2
exit 1
fi
fi
disk=$(root_disk | disk_identifier)
@ -97,10 +107,11 @@ main() {
printf "\$a\nLABEL=%s /nix apfs rw,nobrowse\n.\nwq\n" "$label" | EDITOR=ed sudo vifs
fi
echo "" >&2
echo "The following options can be enabled to disable spotlight indexing" >&2
echo "of the volume, which might be desirable." >&2
echo "" >&2
echo " $ mdutil -i off /nix" >&2
echo " $ sudo mdutil -i off /nix" >&2
echo "" >&2
}

View file

@ -82,7 +82,7 @@ while [ $# -gt 0 ]; do
echo " --create-volume: Create an APFS volume for the store and create the /nix"
echo " mountpoint for it using synthetic.conf."
echo " (required on macOS >=10.15)"
echo " See https://nixos.org/nix/manual/#sect-darwin-apfs-volume"
echo " See https://nixos.org/nix/manual/#sect-apfs-volume-installation"
echo ""
) >&2
fi
@ -102,10 +102,11 @@ if [ "$(uname -s)" = "Darwin" ]; then
(
echo ""
echo "Installing on macOS >=10.15 requires relocating the store to an apfs volume."
echo "Use --create-volume or run the preparation steps manually."
echo "See https://nixos.org/nix/manual/#sect-darwin-apfs-volume."
echo "Use sh <(curl https://nixos.org/nix/install) --create-volume or run the preparation steps manually."
echo "See https://nixos.org/nix/manual/#sect-apfs-volume-installation"
echo ""
) >&2
exit 1
fi
fi