Skip to content

Commit

Permalink
install: improve output and error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
LnL7 committed May 21, 2020
1 parent caface1 commit 04f597c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
3 changes: 2 additions & 1 deletion doc/manual/installation/installing-binary.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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>
Expand Down
17 changes: 14 additions & 3 deletions scripts/create-darwin-volume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
}

Expand Down
7 changes: 4 additions & 3 deletions scripts/install-nix-from-closure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 04f597c

Please sign in to comment.