Fixes for non-Nix applications: Difference between revisions
Initial Commit |
m Update formatting and hyperlinks |
||
| Line 4: | Line 4: | ||
For these applications, instead of using a complicated <code>fhsEnv</code> solution, users can choose to simply bindmount the directories from <code>/run/current-system/sw/share</code> to their respective locations inside <code>/usr/share</code>. | For these applications, instead of using a complicated <code>fhsEnv</code> solution, users can choose to simply bindmount the directories from <code>/run/current-system/sw/share</code> to their respective locations inside <code>/usr/share</code>. | ||
Note that the following fix uses <code>bindfs</code> instead of normal bindmounting or symlinking. This is because of edgecases like [https://github.com/ONLYOFFICE/DocumentServer/issues/1859 OnlyOffice] that will not follow symlinks while evaluating resources under <code>/usr/share</code>. Thus, the <code>[https://bindfs.org/docs/bindfs.1.html#sect10 resolve-symlink]</code> functionality of <code>bindfs</code> becomes crucial for covering even the most niche corner cases. | Note that the following fix uses <code>bindfs</code> instead of normal bindmounting or symlinking. This is because of edgecases like [https://github.com/ONLYOFFICE/DocumentServer/issues/1859 OnlyOffice] that will not follow symlinks while evaluating resources under <code>/usr/share</code>. Thus, the <code>[https://bindfs.org/docs/bindfs.1.html#sect10 resolve-symlink]</code> functionality of <code>bindfs</code> becomes crucial for covering even the most niche corner cases.<syntaxhighlight lang="nixos" line="1"> | ||
# misc-usr-fix.nix | |||
{ pkgs, ... }: | |||
let | |||
# Mount options for the bind mounts | |||
mountOptions = [ | |||
"ro" | |||
"x-gvfs-hide" | |||
# Resolves symlinks as if they were real files | |||
# Needed for things like OnlyOffice | |||
"resolve-symlinks" | |||
]; | |||
in | |||
{ | |||
# Bind mounts fonts, icons and themes from | |||
# The /run/current-system/sw/share/* paths | |||
# to their /usr/share/* equivalents | |||
# Expose all fonts | |||
# under /run/current-system/sw/share/X11/fonts | |||
fonts.fontDir.enable = true; | |||
# Flatpak: Bind mounts /usr/share/* directories | |||
system.fsPackages = [ pkgs.bindfs ]; | |||
# Fonts | |||
fileSystems."/usr/share/fonts" = { | |||
device = "/run/current-system/sw/share/X11/fonts"; | |||
fsType = "fuse.bindfs"; | |||
options = mountOptions; | |||
}; | |||
# Icons | |||
fileSystems."/usr/share/icons" = { | |||
device = "/run/current-system/sw/share/icons"; | |||
fsType = "fuse.bindfs"; | |||
options = mountOptions; | |||
}; | |||
# Themes | |||
fileSystems."/usr/share/themes" = { | |||
device = "/run/current-system/sw/share/themes"; | |||
fsType = "fuse.bindfs"; | |||
options = mountOptions; | |||
}; | |||
} | |||
</syntaxhighlight> | |||
[[Category:Software]] | [[Category:Software]] | ||
[[Category:Fonts]] | [[Category:Fonts]] | ||
Latest revision as of 10:41, 4 August 2026
Flatpak, Distrobox, Appimage and other non-Nix applications can't find system fonts/icons/themes
Flatpak, Distrobox, Appimage and alot of other non-Nix applications sometimes have hardcoded FHS path assumptions for locating fonts, icons and themes. These applications usually expect fonts, icons and themes to be available under /usr/share/fonts, /usr/share/icons and /usr/share/themes, respectively.
For these applications, instead of using a complicated fhsEnv solution, users can choose to simply bindmount the directories from /run/current-system/sw/share to their respective locations inside /usr/share.
Note that the following fix uses bindfs instead of normal bindmounting or symlinking. This is because of edgecases like OnlyOffice that will not follow symlinks while evaluating resources under /usr/share. Thus, the resolve-symlink functionality of bindfs becomes crucial for covering even the most niche corner cases.
# misc-usr-fix.nix
{ pkgs, ... }:
let
# Mount options for the bind mounts
mountOptions = [
"ro"
"x-gvfs-hide"
# Resolves symlinks as if they were real files
# Needed for things like OnlyOffice
"resolve-symlinks"
];
in
{
# Bind mounts fonts, icons and themes from
# The /run/current-system/sw/share/* paths
# to their /usr/share/* equivalents
# Expose all fonts
# under /run/current-system/sw/share/X11/fonts
fonts.fontDir.enable = true;
# Flatpak: Bind mounts /usr/share/* directories
system.fsPackages = [ pkgs.bindfs ];
# Fonts
fileSystems."/usr/share/fonts" = {
device = "/run/current-system/sw/share/X11/fonts";
fsType = "fuse.bindfs";
options = mountOptions;
};
# Icons
fileSystems."/usr/share/icons" = {
device = "/run/current-system/sw/share/icons";
fsType = "fuse.bindfs";
options = mountOptions;
};
# Themes
fileSystems."/usr/share/themes" = {
device = "/run/current-system/sw/share/themes";
fsType = "fuse.bindfs";
options = mountOptions;
};
}