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

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.
This commit is contained in:
Vladislav Grechannik 2025-11-12 16:33:11 +01:00 committed by GitHub
parent dfca39f8af
commit 33f63da61a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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) [
(
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))