From 33f63da61a2e98020ae17c8fd1957dbe3f632382 Mon Sep 17 00:00:00 2001 From: Vladislav Grechannik <52157081+VlaDexa@users.noreply.github.com> Date: Wed, 12 Nov 2025 16:33:11 +0100 Subject: [PATCH] chromium: add finalPackage option (#8155) Adds a finalPackage option to chromium-based browsers. Allows users to use overriden package binary in their setups, without relying on PATH availability. --- modules/programs/chromium.nix | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/modules/programs/chromium.nix b/modules/programs/chromium.nix index 01c67ea2c..88b15f68e 100644 --- a/modules/programs/chromium.nix +++ b/modules/programs/chromium.nix @@ -38,6 +38,15 @@ let description = "The ${name} package to use."; }; + finalPackage = mkOption { + inherit visible; + type = types.package; + readOnly = true; + description = '' + Resulting customized ${name} package + ''; + }; + commandLineArgs = mkOption { inherit visible; type = types.listOf types.str; @@ -212,15 +221,17 @@ let in lib.mkIf cfg.enable { - home.packages = lib.mkIf (cfg.package != null) [ - ( - if cfg.commandLineArgs != [ ] then - cfg.package.override { - commandLineArgs = lib.concatStringsSep " " cfg.commandLineArgs; - } - else - cfg.package - ) + programs.${browser}.finalPackage = lib.mkIf (cfg.package != null) ( + if cfg.commandLineArgs != [ ] then + cfg.package.override { + commandLineArgs = lib.concatStringsSep " " cfg.commandLineArgs; + } + else + cfg.package + ); + + home.packages = lib.mkIf (cfg.finalPackage != null) [ + cfg.finalPackage ]; home.file = lib.optionalAttrs (!isProprietaryChrome) ( lib.listToAttrs ((map extensionJson cfg.extensions) ++ (map dictionary cfg.dictionaries))