1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-01 14:41:03 +01:00

firefox: add release option (#6784)

Adds the `release` option to declare what upstream release version is
used to fetch rom `releases.mozilla.org`. Used to fetch
language packs. See
https://github.com/nix-community/home-manager/issues/6758#issuecomment-2781465236.
This commit is contained in:
bricked 2025-07-06 14:35:49 +00:00 committed by GitHub
parent 502d9b7d30
commit 153e680c42
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -24,6 +24,7 @@ let
mkIf mkIf
mkMerge mkMerge
mkOption mkOption
mkOptionDefault
optionalString optionalString
optional optional
setAttrByPath setAttrByPath
@ -235,6 +236,12 @@ in
''; '';
}; };
release = mkOption {
internal = true;
type = types.str;
description = "Upstream release version used to fetch from `releases.mozilla.org`.";
};
languagePacks = mkOption { languagePacks = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [ ];
@ -242,7 +249,9 @@ in
The language packs to install. Available language codes can be found The language packs to install. Available language codes can be found
on the releases page: on the releases page:
`https://releases.mozilla.org/pub/firefox/releases/''${version}/linux-x86_64/xpi/`, `https://releases.mozilla.org/pub/firefox/releases/''${version}/linux-x86_64/xpi/`,
replacing `''${version}` with the version of ${appName} you have. replacing `''${version}` with the version of ${appName} you have. If
the version string of your Firefox derivative diverts from the upstream
version, try setting the `release` option.
''; '';
example = [ example = [
"en-GB" "en-GB"
@ -952,6 +961,7 @@ in
} }
// setAttrByPath modulePath { // setAttrByPath modulePath {
finalPackage = wrapPackage cfg.package; finalPackage = wrapPackage cfg.package;
release = mkOptionDefault (builtins.head (lib.splitString "-" cfg.package.version));
policies = { policies = {
ExtensionSettings = lib.mkIf (cfg.languagePacks != [ ]) ( ExtensionSettings = lib.mkIf (cfg.languagePacks != [ ]) (
@ -960,7 +970,7 @@ in
lang: lang:
lib.nameValuePair "langpack-${lang}@firefox.mozilla.org" { lib.nameValuePair "langpack-${lang}@firefox.mozilla.org" {
installation_mode = "normal_installed"; installation_mode = "normal_installed";
install_url = "https://releases.mozilla.org/pub/firefox/releases/${cfg.package.version}/linux-x86_64/xpi/${lang}.xpi"; install_url = "https://releases.mozilla.org/pub/firefox/releases/${cfg.release}/linux-x86_64/xpi/${lang}.xpi";
} }
) cfg.languagePacks ) cfg.languagePacks
) )