ONLYOFFICE: Difference between revisions

m ONLYOFFICE full uppercase
Restored back the MS Corefont installation part that I accidentally nuked
 
(7 intermediate revisions by 5 users not shown)
Line 4: Line 4:


Add following line to your configuration to enable ONLYOFFICE
Add following line to your configuration to enable ONLYOFFICE
{{file|/etc/nixos/configuration.nix|nix|3=<nowiki>
environment.systemPackages = [ pkgs.onlyoffice-desktopeditors ];
</nowiki>}}
=== Install missing corefonts ===
By default, NixOS doesn't ship with any of the Microsoft fonts OOTB, to get the Microsoft corefonts, add the following to your NixOS config:


{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
environment.systemPackages = [ pkgs.onlyoffice-bin ];
# Allow installation of unfree corefonts package
nixpkgs.config.allowUnfreePredicate = pkg:
  builtins.elem (lib.getName pkg) [ "corefonts" ];
 
fonts.fonts = with pkgs; [
  corefonts
];
</nowiki>}}
</nowiki>}}


== Troubleshooting ==
== Troubleshooting ==


=== Install and use missing corefonts ===
=== OnlyOffice can't see or use any system fonts ===
 
According to one [https://github.com/ONLYOFFICE/DocumentServer/issues/1859 upstream bug] ONLYOFFICE DesktopEditors is unable to locate [[Fonts|font]] files on NixOS.
 
Currently, the best workaround to first apply the fix mentioned in [[Fixes for non-Nix applications#Flatpak, Distrobox, Appimage and other non-Nix applications can't find system fonts/icons/themes]], then, as ONLYOFFICE DeskopEditors is currently packaged with FHSEnv and bwrap as of NixOS 26.05, pass the <code>/usr/share/fonts</code> directory inside the bubblewrap/FHSEnv sandbox:<syntaxhighlight lang="nixos" line="1">
# onlyoffice-font-fix.nix
 
{ config, pkgs, ... }:
 
{
  # Expose installed fonts under /run/current-system/sw/share/X11/fonts
  fonts.fontDir.enable = true;


According to one [https://github.com/ONLYOFFICE/DocumentServer/issues/1859 upstream bug] ONLYOFFICE is unable to locate font files on NixOS. A workaround is to install missing or additional fonts and copy them to the user directory
  # OnlyOffice font fix
  nixpkgs.overlays = [
    (final: prev: {
      onlyoffice-desktopeditors = prev.buildFHSEnv (
        prev.onlyoffice-desktopeditors.passthru.args
        // {
          extraBwrapArgs = (prev.onlyoffice-desktopeditors.passthru.args.extraBwrapArgs or [ ]) ++ [
            # Bind mount host system fonts into the FHS container's /usr/share/fonts:
            "--ro-bind"
            "/usr/share/fonts"
            "/usr/share/fonts"
          ];
        }
      );
    })
  ];
}
</syntaxhighlight>Another workaround is to install missing or additional fonts and copy them to the user directory


{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
Line 26: Line 67:


<syntaxhighlight lang="console">
<syntaxhighlight lang="console">
# mkdir -p ~/.local/share/fonts
$ mkdir -p ~/.local/share/fonts
Query store path to the corefonts package
$ # Query store path to the corefonts package
# NIXPKGS_ALLOW_UNFREE=1 nix-store --query --outputs $(nix-instantiate '<nixpkgs>' -A corefonts)
$ NIXPKGS_ALLOW_UNFREE=1 nix-store --query --outputs $(nix-instantiate '<nixpkgs>' -A corefonts)
Change the store path according to result of the command above
$ # Change the store path according to result of the command above
# cp /nix/store/ssw7d3cl2dzps6y1c88c01xclsigmjqf-corefonts-1/share/fonts/truetype/* ~/.local/share/fonts/
$ cp /nix/store/ssw7d3cl2dzps6y1c88c01xclsigmjqf-corefonts-1/share/fonts/truetype/* ~/.local/share/fonts/
# chmod 644 ~/.local/share/fonts/*
$ chmod 644 ~/.local/share/fonts/*
</syntaxhighlight>
</syntaxhighlight>


Line 37: Line 78:


* [[LibreOffice]], personal productivity suite that gives you six feature-rich applications for all your document production and data processing needs: Writer, Calc, Impress, Draw, Math and Base.
* [[LibreOffice]], personal productivity suite that gives you six feature-rich applications for all your document production and data processing needs: Writer, Calc, Impress, Draw, Math and Base.
* [[Onlyoffice-Documentserver|ONLYOFFICE DocumentServer]]
* [[ONLYOFFICE DocumentServer]]


[[Category:Applications]]
[[Category:Applications]]