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";
    })
  ];
wip/yesman
Michael Weiss 6 years ago committed by GitHub
parent d4893a74e5
commit 9ef1406a99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      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

Loading…
Cancel
Save