1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-31 04:04:45 +00:00

installer: try creating /run using synthetic.conf

Since macOS 10.15 Catalina / can't be changed directly anymore.

Fixes #166
This commit is contained in:
Daiderd Jordan 2020-03-28 16:03:48 +01:00
parent 75fa7cd6bf
commit 80a8a591a9
No known key found for this signature in database
GPG key ID: D02435D05B810C96
2 changed files with 24 additions and 5 deletions

View file

@ -25,9 +25,20 @@ let
if ! test -e /run; then
echo "error: Directory /run does not exist, aborting activation" >&2
echo "Create a symlink to /var/run with:" >&2
echo >&2
echo " sudo ln -s private/var/run /run" >&2
echo >&2
if test -e /etc/synthetic.conf; then
echo >&2
echo "$ echo "run\tprivate/var/run" | sudo tee -a /etc/synthetic.conf" >&2
echo "$ /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -B" >&2
echo >&2
echo "The current contents of /etc/synthetic.conf is:" >&2
echo >&2
sed 's/^/ /' /etc/synthetic.conf >&2
echo >&2
else
echo >&2
echo "$ sudo ln -s private/var/run /run" >&2
echo >&2
fi
exit 2
fi
'';

View file

@ -12,6 +12,7 @@ with lib;
PATH=/nix/var/nix/profiles/default/bin:$PATH
darwinPath=$(NIX_PATH=${concatStringsSep ":" config.nix.nixPath} nix-instantiate --eval -E '<darwin>' 2> /dev/null) || true
i=y
if ! test -e "$darwinPath"; then
if test -t 1; then
read -p "Would you like to manage <darwin> with nix-channel? [y/n] " i
@ -47,13 +48,20 @@ with lib;
fi
if ! test -L /run; then
echo "setting up /run..."
if test -t 1; then
read -p "Would you like to create /run? [y/n] " i
fi
case "$i" in
y|Y)
sudo ln -sfn private/var/run /run
if ! grep -q '^run\b' /etc/synthetic.conf 2>/dev/null; then
echo "setting up /etc/synthetic.conf..."
echo -e "run\tprivate/var/run" | sudo tee -a /etc/synthetic.conf >/dev/null
/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -B 2>/dev/null || true
fi
if ! test -L /run; then
echo "setting up /run..."
sudo ln -sfn private/var/run /run
fi
;;
esac
fi