which successfully symlinked the custom fonts into the macOS fonts directory. But Font Book did not pick up the symlinked fonts. It did pick up the fonts specified in home.packages.
I observed that home-manager itself had copied, not symlinked, the fonts I had specified in home.packages. So I set out to instruct the home-manager to copy the custom-fonts through an activation script:
Note that I have set the script to be entered after writeBoundary, as specified in the home-manager manual.
The custom-fonts were copied successfully when the ~/Library/Fonts/HomeManagerExtra directory did not exist. However it failed on a second run with a permission error:
>> home-manager switch
/nix/store/1pjsk5hmq9daj80avfna3njzqdx3rxq9-home-manager-generation
Starting home manager activation
Activating checkFilesChanged
Activating checkLinkTargets
Activating writeBoundary
Activating copyExtraFonts
rm: cannot remove '/Users/jayesh/Library/Fonts/HomeManagerExtra/InputMono/InputMonoNarrow/InputMonoNarrow-BoldItalic.ttf': Permission denied
rm: cannot remove '/Users/jayesh/Library/Fonts/HomeManagerExtra/InputMono/InputMonoNarrow/InputMonoNarrow-ThinItalic.ttf': Permission denied
rm: cannot remove '/Users/jayesh/Library/Fonts/HomeManagerExtra/InputMono/InputMonoNarrow/InputMonoNarrow-ExtraLight.ttf': Permission denied
rm: cannot remove '/Users/jayesh/Library/Fonts/HomeManagerExtra/InputMono/InputMonoNarrow/InputMonoNarrow-MediumItalic.ttf': Permission denied
rm: cannot remove '/Users/jayesh/Library/Fonts/HomeManagerExtra/InputMono/InputMonoNarrow/InputMonoNarrow-Italic.ttf': Permission denied
...
There are 113 unread and relevant news items.
Read them by running the command 'home-manager news'.
Any clues on what is going wrong? I can’t think of a reason as to why home-manager does not have permission to remove-then-copy the custom-fonts, when it could happily copy the fonts from home.packages.
PS: Initially, the activation script did not have the rm command. Even in that case, the second run had failed because of lack of permission to cp.