diff options
author | linsui <linsui555@gmail.com> | 2022-12-18 20:48:49 +0800 |
---|---|---|
committer | linsui <linsui555@gmail.com> | 2022-12-18 20:48:49 +0800 |
commit | 8153ba84caad90ddf1d74e7b95d97f1504a568b7 (patch) | |
tree | 18203f1fd00328708d8256195884d090e17a295a /nixos/modules/programs | |
parent | ee1a49d09522ca6ce84e1b429a8cc8be717eec38 (diff) |
nixos/firefox: add languagePacks config
Diffstat (limited to 'nixos/modules/programs')
-rw-r--r-- | nixos/modules/programs/firefox.nix | 121 |
1 files changed, 119 insertions, 2 deletions
diff --git a/nixos/modules/programs/firefox.nix b/nixos/modules/programs/firefox.nix index dfd912cdf5c11..3a5105c57d767 100644 --- a/nixos/modules/programs/firefox.nix +++ b/nixos/modules/programs/firefox.nix @@ -42,7 +42,7 @@ in description = mdDoc '' Group policies to install. - See [Mozilla's documentation](https://github.com/mozilla/policy-templates/blob/master/README.md") + See [Mozilla's documentation](https://github.com/mozilla/policy-templates/blob/master/README.md) for a list of available options. This can be used to install extensions declaratively! Check out the @@ -79,6 +79,114 @@ in ''; }; + languagePacks = mkOption { + # Available languages can be found in https://releases.mozilla.org/pub/firefox/releases/${cfg.package.version}/linux-x86_64/xpi/ + type = types.listOf (types.enum ([ + "ach" + "af" + "an" + "ar" + "ast" + "az" + "be" + "bg" + "bn" + "br" + "bs" + "ca-valencia" + "ca" + "cak" + "cs" + "cy" + "da" + "de" + "dsb" + "el" + "en-CA" + "en-GB" + "en-US" + "eo" + "es-AR" + "es-CL" + "es-ES" + "es-MX" + "et" + "eu" + "fa" + "ff" + "fi" + "fr" + "fy-NL" + "ga-IE" + "gd" + "gl" + "gn" + "gu-IN" + "he" + "hi-IN" + "hr" + "hsb" + "hu" + "hy-AM" + "ia" + "id" + "is" + "it" + "ja" + "ka" + "kab" + "kk" + "km" + "kn" + "ko" + "lij" + "lt" + "lv" + "mk" + "mr" + "ms" + "my" + "nb-NO" + "ne-NP" + "nl" + "nn-NO" + "oc" + "pa-IN" + "pl" + "pt-BR" + "pt-PT" + "rm" + "ro" + "ru" + "sco" + "si" + "sk" + "sl" + "son" + "sq" + "sr" + "sv-SE" + "szl" + "ta" + "te" + "th" + "tl" + "tr" + "trs" + "uk" + "ur" + "uz" + "vi" + "xh" + "zh-CN" + "zh-TW" + ])); + default = [ ]; + description = mdDoc '' + The language packs to install. + ''; + }; + autoConfig = mkOption { type = types.lines; default = ""; @@ -136,10 +244,19 @@ in }; # Preferences are converted into a policy - programs.firefox.policies = mkIf (cfg.preferences != { }) { + programs.firefox.policies = { Preferences = (mapAttrs (_: value: { Value = value; Status = cfg.preferencesStatus; }) cfg.preferences); + ExtensionSettings = listToAttrs (map + (lang: nameValuePair + "langpack-${lang}@firefox.mozilla.org" + { + installation_mode = "normal_installed"; + install_url = "https://releases.mozilla.org/pub/firefox/releases/${cfg.package.version}/linux-x86_64/xpi/${lang}.xpi"; + } + ) + cfg.languagePacks); }; }; |