summaryrefslogtreecommitdiff
path: root/modules/fonts
diff options
context:
space:
mode:
authorThibault Gagnaux <thibault@gagnaux.ch>2019-10-22 08:24:13 +0200
committerThibault Gagnaux <thibault@gagnaux.ch>2019-12-22 14:52:01 +0100
commita5d863ee64e429a3918589f0e708dc8a97026d8f (patch)
treec936821bb07312c2750099c6e65c274ad8126e7c /modules/fonts
parent3ec36dd6673198a8a6fcd433866654e4155c7eb6 (diff)
fonts: Adds support if Nix is on another filesystem.
On Catalina, the default way is to install Nix on a new volume which breaks hardlinking the font files. If that is the case I just copy them.
Diffstat (limited to 'modules/fonts')
-rw-r--r--modules/fonts/default.nix8
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/fonts/default.nix b/modules/fonts/default.nix
index f218cbe..a072df2 100644
--- a/modules/fonts/default.nix
+++ b/modules/fonts/default.nix
@@ -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
+ cp -fP "$f" /Library/Fonts
+ }
fi
done