From 153e680c4263fbd8fa416ef5b8ef13397e02fd2f Mon Sep 17 00:00:00 2001 From: bricked Date: Sun, 6 Jul 2025 14:35:49 +0000 Subject: [PATCH] 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. --- modules/programs/firefox/mkFirefoxModule.nix | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/programs/firefox/mkFirefoxModule.nix b/modules/programs/firefox/mkFirefoxModule.nix index 8007a9a49..33c022890 100644 --- a/modules/programs/firefox/mkFirefoxModule.nix +++ b/modules/programs/firefox/mkFirefoxModule.nix @@ -24,6 +24,7 @@ let mkIf mkMerge mkOption + mkOptionDefault optionalString optional 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 { type = types.listOf types.str; default = [ ]; @@ -242,7 +249,9 @@ in The language packs to install. Available language codes can be found on the releases page: `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 = [ "en-GB" @@ -952,6 +961,7 @@ in } // setAttrByPath modulePath { finalPackage = wrapPackage cfg.package; + release = mkOptionDefault (builtins.head (lib.splitString "-" cfg.package.version)); policies = { ExtensionSettings = lib.mkIf (cfg.languagePacks != [ ]) ( @@ -960,7 +970,7 @@ in lang: lib.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"; + install_url = "https://releases.mozilla.org/pub/firefox/releases/${cfg.release}/linux-x86_64/xpi/${lang}.xpi"; } ) cfg.languagePacks )