From c95bfd235b6a94a9bf748abff408f9a598974183 Mon Sep 17 00:00:00 2001 From: Martin Milata Date: Mon, 17 Feb 2020 14:50:38 +0100 Subject: [PATCH] libreoffice: wrapper: add hunspell dirs to DICPATH LibreOffice doesn't know where to look for hunspell dictionaries on NixOS but we can use the DICPATH env var to point to them. Now spellchecking with system dictionaries works. Note that some of these dictionaries are built from LibreOffice repos - this is preferable to building them as part of LO as other applications can use them. --- pkgs/applications/office/libreoffice/src-fresh/primary.nix | 3 ++- pkgs/applications/office/libreoffice/src-still/primary.nix | 3 ++- pkgs/applications/office/libreoffice/wrapper.sh | 7 +++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/office/libreoffice/src-fresh/primary.nix b/pkgs/applications/office/libreoffice/src-fresh/primary.nix index 28bf127c398..636f4b360ea 100644 --- a/pkgs/applications/office/libreoffice/src-fresh/primary.nix +++ b/pkgs/applications/office/libreoffice/src-fresh/primary.nix @@ -26,7 +26,8 @@ rec { sha256 = "0730fw2kr00b2d56jkdzjdz49c4k4mxiz879c7ikw59c5zvrh009"; }; - # TODO: dictionaries + # the "dictionaries" archive is not used for LO build because we already build hunspellDicts packages from + # it and LibreOffice can use these by pointing DICPATH environment variable at the hunspell directory help = fetchSrc { name = "help"; diff --git a/pkgs/applications/office/libreoffice/src-still/primary.nix b/pkgs/applications/office/libreoffice/src-still/primary.nix index a27087a1b05..502bcc54d0c 100644 --- a/pkgs/applications/office/libreoffice/src-still/primary.nix +++ b/pkgs/applications/office/libreoffice/src-still/primary.nix @@ -25,7 +25,8 @@ rec { sha256 = "1l5v9bb7n9s6i24q4mdyqyp5v4f8iy0a9dmpgw649vngj1zxdxfh"; }; - # TODO: dictionaries + # the "dictionaries" archive is not used for LO build because we already build hunspellDicts packages from + # it and LibreOffice can use these by pointing DICPATH environment variable at the hunspell directory help = fetchSrc { name = "help"; diff --git a/pkgs/applications/office/libreoffice/wrapper.sh b/pkgs/applications/office/libreoffice/wrapper.sh index 62569734745..806dd0806ad 100644 --- a/pkgs/applications/office/libreoffice/wrapper.sh +++ b/pkgs/applications/office/libreoffice/wrapper.sh @@ -17,6 +17,13 @@ if uname | grep Linux > /dev/null && export DBUS_SESSION_BUS_ADDRESS="unix:path=$dbus_socket_dir/session" fi +for PROFILE in $NIX_PROFILES; do + HDIR="$PROFILE/share/hunspell" + if [ -d "$HDIR" ]; then + export DICPATH=$DICPATH''${DICPATH:+:}$HDIR + fi +done + "@libreoffice@/bin/$(basename "$0")" "$@" code="$?"