This article tell us how to add new fonts in OnlyOffice, one of them is to put the fonts in the ~/.local/share/fonts, but the fonts must have permissions 644 (-rw-r--r--).
I can download the fonts and put the fonts in those folder but how to do that in declarative way? like included in configuration.nix or home.nix if using home-manager? Tried to create link in ~/.local/share/fonts point to /run/current-system/sw/share/X11/fonts but none of the fonts is detected in OnlyOffice.
They probably assume regular linux. Just make sure to put your fonts to $out/share/fonts, then font-cache should catch them up eventually after installing the package through environment.systemPackages/home.packages.
There is no reason at all for a font beeing writable by anyone.
Also, if the application doesn’t use font config to look up the fonts, but doing their own thing, that’s a bug, as it behaves different from all other programs in the Linux world.
I suspected that ONLYOFFICE can’t find fonts installed declaratively because it’s looking for fonts at /usr/share/fonts instead of using fontconfig.
I created a patch for the fonts.fontDir module to create /usr/share/fonts with an activation script, but ONLYOFFICE still can’t find the fonts. There are plenty of *.ttf files in /usr/share/fonts, yet ONLYOFFICE still presents a limited list of available fonts.
I believe the problem comes from upstream. In short, the code which reads directories, which is used when reading the files in /usr/share/fonts, doesn’t handle symlinks.
Note that that’s a pretty significant wart; you’re reducing reproducibilty. You will no longer be able to have fonts only for specific applications, or multiple versions of the same font.
Similar suggestions about just creating /bin/bash are always turned down. You can carry it downstream as a workaround, obviously, but I don’t think this should be merged.
It would be much better to just teach onlyoffice to respect fontconfig, or maybe to package it with an fhsUserEnv.