1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-19 00:09:48 +01:00

chromium: fix commandLineArgs to use the user specified package (#4175)

This commit is contained in:
ThinkChaos 2023-07-01 09:41:37 -04:00 committed by GitHub
parent 44d1a8542a
commit 7a0e9a6782
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -42,9 +42,6 @@ let
description = '' description = ''
List of command-line arguments to be passed to ${name}. List of command-line arguments to be passed to ${name}.
</para><para> </para><para>
Note this option does not have any effect when using a
custom package for <option>programs.${browser}.package</option>.
</para><para>
For a list of common switches, see For a list of common switches, see
<link xlink:href="https://chromium.googlesource.com/chromium/src/+/refs/heads/main/chrome/common/chrome_switches.cc">Chrome switches</link>. <link xlink:href="https://chromium.googlesource.com/chromium/src/+/refs/heads/main/chrome/common/chrome_switches.cc">Chrome switches</link>.
</para><para> </para><para>
@ -162,21 +159,19 @@ let
}); });
}; };
package = if cfg.commandLineArgs != [ ] then
cfg.package.override {
commandLineArgs = concatStringsSep " " cfg.commandLineArgs;
}
else
cfg.package;
in mkIf cfg.enable { in mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = [ package ];
home.file = optionalAttrs (!isProprietaryChrome) home.file = optionalAttrs (!isProprietaryChrome)
(listToAttrs (map extensionJson cfg.extensions)); (listToAttrs (map extensionJson cfg.extensions));
}; };
browserPkgs = genAttrs supportedBrowsers (browser:
let cfg = config.programs.${browser};
in if cfg.commandLineArgs != [ ] then
pkgs.${browser}.override {
commandLineArgs = concatStringsSep " " cfg.commandLineArgs;
}
else
pkgs.${browser});
in { in {
# Extensions do not work with the proprietary Google Chrome version # Extensions do not work with the proprietary Google Chrome version
# see https://github.com/nix-community/home-manager/issues/1383 # see https://github.com/nix-community/home-manager/issues/1383
@ -188,15 +183,14 @@ in {
]; ];
options.programs = { options.programs = {
chromium = browserModule browserPkgs.chromium "Chromium" true; chromium = browserModule pkgs.chromium "Chromium" true;
google-chrome = google-chrome = browserModule pkgs.google-chrome "Google Chrome" false;
browserModule browserPkgs.google-chrome "Google Chrome" false;
google-chrome-beta = google-chrome-beta =
browserModule browserPkgs.google-chrome-beta "Google Chrome Beta" false; browserModule pkgs.google-chrome-beta "Google Chrome Beta" false;
google-chrome-dev = google-chrome-dev =
browserModule browserPkgs.google-chrome-dev "Google Chrome Dev" false; browserModule pkgs.google-chrome-dev "Google Chrome Dev" false;
brave = browserModule browserPkgs.brave "Brave Browser" false; brave = browserModule pkgs.brave "Brave Browser" false;
vivaldi = browserModule browserPkgs.vivaldi "Vivaldi Browser" false; vivaldi = browserModule pkgs.vivaldi "Vivaldi Browser" false;
}; };
config = mkMerge config = mkMerge