1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-13 20:30:02 +00:00

Merge pull request #169 from tricktron/fix/fonts-catalina

fonts: Adds support if Nix is on another filesystem.
This commit is contained in:
Daiderd Jordan 2020-03-03 19:19:21 +01:00 committed by GitHub
commit 1ffae69c56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -45,10 +45,12 @@ in
find -L "$systemConfig/Library/Fonts" -type f -print0 | while IFS= read -rd "" l; do
font=''${l##*/}
f=$(readlink -f "$l")
if [ ! -e "/Library/Fonts/$font" ] || [ $(stat -c '%i' "$f") != $(stat -c '%i' "/Library/Fonts/$font") ]; then
if [ ! -e "/Library/Fonts/$font" ]; then
echo "updating font $font..." >&2
# FIXME: hardlink, won't work if nix is on a dedicated filesystem.
ln -fn "$f" /Library/Fonts
ln -fn -- "$f" /Library/Fonts 2>/dev/null || {
echo "Could not create hard link. Nix is probably on another filesystem. Copying the font instead..." >&2
rsync -az --inplace "$f" /Library/Fonts
}
fi
done

View file

@ -17,7 +17,7 @@ in
echo "checking activation of fonts in /activate" >&2
grep "fontrestore default -n 2>&1" ${config.out}/activate
grep 'ln -fn ".*" /Library/Fonts' ${config.out}/activate
grep 'ln -fn ".*" /Library/Fonts' ${config.out}/activate || grep 'rsync -az --inplace ".*" /Library/Fonts' ${config.out}/activate
grep 'rm "/Library/Fonts/.*"' ${config.out}/activate
'';
}