From 9ef1406a9918f3414d081563ba34084c5e187a58 Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Sat, 4 Aug 2018 16:01:44 +0200 Subject: [PATCH] signal-desktop: Allow overriding the spell checker language (#44456) Thought this could be useful for others as well. Unfortunately it will also override the UI language. Example usage: environment.systemPackages = with pkgs; [ (signal-desktop.override { spellcheckerLanguage = "de_DE"; }) ]; --- .../signal-desktop/default.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pkgs/applications/networking/instant-messengers/signal-desktop/default.nix b/pkgs/applications/networking/instant-messengers/signal-desktop/default.nix index b7066a501a3..459bdf98b1e 100644 --- a/pkgs/applications/networking/instant-messengers/signal-desktop/default.nix +++ b/pkgs/applications/networking/instant-messengers/signal-desktop/default.nix @@ -3,9 +3,24 @@ , dbus, libX11, xorg, libXi, libXcursor, libXdamage, libXrandr, libXcomposite , libXext, libXfixes, libXrender, libXtst, libXScrnSaver, nss, nspr, alsaLib , cups, expat, udev +# Unfortunately this also overwrites the UI language (not just the spell +# checking language!): +, hunspellDicts, spellcheckerLanguage ? null # E.g. "de_DE" +# For a full list of available languages: +# $ cat pkgs/development/libraries/hunspell/dictionaries.nix | grep "dictFileName =" | awk '{ print $3 }' }: let + customLanguageWrapperArgs = (with lib; + let + # E.g. "de_DE" -> "de-de" (spellcheckerLanguage -> hunspellDict) + spellLangComponents = splitString "_" spellcheckerLanguage; + hunspellDict = elemAt spellLangComponents 0 + "-" + toLower (elemAt spellLangComponents 1); + in if spellcheckerLanguage != null + then '' + --set HUNSPELL_DICTIONARIES "${hunspellDicts.${hunspellDict}}/share/hunspell" \ + --set LC_MESSAGES "${spellcheckerLanguage}"'' + else ""); rpath = lib.makeLibraryPath [ alsaLib atk @@ -68,6 +83,7 @@ in stdenv.mkDerivation rec { --set-rpath ${rpath}:$out/libexec $out/libexec/signal-desktop wrapProgram $out/libexec/signal-desktop \ --prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \ + ${customLanguageWrapperArgs} \ "''${gappsWrapperArgs[@]}" # Symlink to bin