-
Notifications
You must be signed in to change notification settings - Fork 411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fonts module should use a subdirectory #722
Comments
I just tested this out directly, copying all the fonts into |
Agreed. There's no reason to use |
A subdirectory might work, but if I recall correctly the actual files need to be copied over so symlinks are a problem. |
You can use |
Yeah this is very easy to implement. The main question I have is how we should handle migration? We could just leave the old fonts there to rot, but I don't know how macOS will behave when you have an old and new version of the same font in |
Font Book has an option to detect duplicate fonts, but it’s a manual process. Still, I think it’s largely harmless, though I don’t know what happens once the font gets updated. nix-darwin could delete any fonts that are an exact match for the fonts it’s installing in the subdirectory, but that’s kind of surprising behavior as an ongoing thing. It could perhaps do this only if the subdirectory didn’t exist before, but it’s still a bit odd to do when enabling the module for the first time. Maybe add a new option for using the subdirectory, default it to false for existing state versions and true for a new state version, and document it. This way users can set it themselves and know to clean up previously-installed fonts. Also perhaps mention this option in the docs for |
How about, treat fonts that are already present, similar to the way that home-manager will handle shell profiles that are already present. |
The problem is that we shouldn't assume that all fonts in I think probably the best solution here is just another good reason for #727: switch wholesale over to the subdirectory and mention in release notes that the user should manually clean up old copies of fonts. |
Looking at the fonts module, it's documented as removing any fonts from
/Library/Fonts
not managed by nix-darwin. As of macOS 13.0 it doesn't do this anymore, but that appears to be a compromise for a bug, and I imagine that if a workaround is found in the future then the fonts module will start removing unmanaged fonts again.In a quick experiment with
~/Library/Fonts
, it appears that adding a subdirectory and placing a font in that subdirectory works fine. Upon doing so, Font Book immediately showed the new font.Given this, it seems like a good approach here is to have nix-darwin create a subdirectory in
/Library/Fonts
where it can place everything. This will allow nix-darwin's fonts to coexist with externally-installed fonts and also make it easy to uninstall fonts that were removed from the nix-darwin configuration on macOS 13 (just rsync the whole folder instead of doing one-by-one font management). This also provides an easy way to uninstall fonts if I disable the fonts module (whereas today disabling the fonts module will leave all currently-installed fonts in place) as the activation script can unconditionally remove the folder if the option is disabled.The text was updated successfully, but these errors were encountered: