2020-04-24 23:36:52 +00:00
|
|
|
{ config, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.programs.chromium;
|
|
|
|
|
|
|
|
defaultProfile = filterAttrs (k: v: v != null) {
|
|
|
|
HomepageLocation = cfg.homepageLocation;
|
2022-01-19 23:45:15 +00:00
|
|
|
DefaultSearchProviderEnabled = cfg.defaultSearchProviderEnabled;
|
2020-04-24 23:36:52 +00:00
|
|
|
DefaultSearchProviderSearchURL = cfg.defaultSearchProviderSearchURL;
|
|
|
|
DefaultSearchProviderSuggestURL = cfg.defaultSearchProviderSuggestURL;
|
2020-05-03 17:38:23 +00:00
|
|
|
ExtensionInstallForcelist = cfg.extensions;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
programs.chromium = {
|
2022-09-09 14:08:57 +00:00
|
|
|
enable = mkEnableOption (lib.mdDoc "{command}`chromium` policies");
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
extensions = mkOption {
|
|
|
|
type = types.listOf types.str;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc ''
|
2020-04-24 23:36:52 +00:00
|
|
|
List of chromium extensions to install.
|
|
|
|
For list of plugins ids see id in url of extensions on
|
2022-08-12 12:06:08 +00:00
|
|
|
[chrome web store](https://chrome.google.com/webstore/category/extensions)
|
2020-05-03 17:38:23 +00:00
|
|
|
page. To install a chromium extension not included in the chrome web
|
|
|
|
store, append to the extension id a semicolon ";" followed by a URL
|
|
|
|
pointing to an Update Manifest XML file. See
|
2022-08-12 12:06:08 +00:00
|
|
|
[ExtensionInstallForcelist](https://cloud.google.com/docs/chrome-enterprise/policies/?policy=ExtensionInstallForcelist)
|
2020-05-03 17:38:23 +00:00
|
|
|
for additional details.
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
default = [];
|
2021-10-06 13:57:05 +00:00
|
|
|
example = literalExpression ''
|
2020-04-24 23:36:52 +00:00
|
|
|
[
|
|
|
|
"chlffgpmiacpedhhbkiomidkjlcfhogd" # pushbullet
|
|
|
|
"mbniclmhobmnbdlbpiphghaielnnpgdp" # lightshot
|
|
|
|
"gcbommkclmclpchllfjekcdonpmejbdp" # https everywhere
|
|
|
|
"cjpalhdlnbpafiamejdnhcphjbkeiagm" # ublock origin
|
|
|
|
]
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
homepageLocation = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc "Chromium default homepage";
|
2020-04-24 23:36:52 +00:00
|
|
|
default = null;
|
|
|
|
example = "https://nixos.org";
|
|
|
|
};
|
|
|
|
|
2022-01-19 23:45:15 +00:00
|
|
|
defaultSearchProviderEnabled = mkOption {
|
|
|
|
type = types.nullOr types.bool;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc "Enable the default search provider.";
|
2022-01-19 23:45:15 +00:00
|
|
|
default = null;
|
|
|
|
example = true;
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
defaultSearchProviderSearchURL = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc "Chromium default search provider url.";
|
2020-04-24 23:36:52 +00:00
|
|
|
default = null;
|
|
|
|
example =
|
|
|
|
"https://encrypted.google.com/search?q={searchTerms}&{google:RLZ}{google:originalQueryForSuggestion}{google:assistedQueryStats}{google:searchFieldtrialParameter}{google:searchClient}{google:sourceId}{google:instantExtendedEnabledParameter}ie={inputEncoding}";
|
|
|
|
};
|
|
|
|
|
|
|
|
defaultSearchProviderSuggestURL = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc "Chromium default search provider url for suggestions.";
|
2020-04-24 23:36:52 +00:00
|
|
|
default = null;
|
|
|
|
example =
|
|
|
|
"https://encrypted.google.com/complete/search?output=chrome&q={searchTerms}";
|
|
|
|
};
|
|
|
|
|
|
|
|
extraOpts = mkOption {
|
|
|
|
type = types.attrs;
|
2022-08-21 13:32:41 +00:00
|
|
|
description = lib.mdDoc ''
|
2020-06-02 18:00:15 +00:00
|
|
|
Extra chromium policy options. A list of available policies
|
|
|
|
can be found in the Chrome Enterprise documentation:
|
2022-08-21 13:32:41 +00:00
|
|
|
<https://cloud.google.com/docs/chrome-enterprise/policies/>
|
2020-06-02 18:00:15 +00:00
|
|
|
Make sure the selected policy is supported on Linux and your browser version.
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
default = {};
|
2021-10-06 13:57:05 +00:00
|
|
|
example = literalExpression ''
|
2020-06-02 18:00:15 +00:00
|
|
|
{
|
|
|
|
"BrowserSignin" = 0;
|
|
|
|
"SyncDisabled" = true;
|
|
|
|
"PasswordManagerEnabled" = false;
|
|
|
|
"SpellcheckEnabled" = true;
|
|
|
|
"SpellcheckLanguage" = [
|
|
|
|
"de"
|
|
|
|
"en-US"
|
|
|
|
];
|
|
|
|
}
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
# for chromium
|
|
|
|
environment.etc."chromium/policies/managed/default.json".text = builtins.toJSON defaultProfile;
|
|
|
|
environment.etc."chromium/policies/managed/extra.json".text = builtins.toJSON cfg.extraOpts;
|
|
|
|
# for google-chrome https://www.chromium.org/administrators/linux-quick-start
|
|
|
|
environment.etc."opt/chrome/policies/managed/default.json".text = builtins.toJSON defaultProfile;
|
|
|
|
environment.etc."opt/chrome/policies/managed/extra.json".text = builtins.toJSON cfg.extraOpts;
|
2022-04-27 09:35:20 +00:00
|
|
|
# for brave
|
|
|
|
environment.etc."brave/policies/managed/default.json".text = builtins.toJSON defaultProfile;
|
|
|
|
environment.etc."brave/policies/managed/extra.json".text = builtins.toJSON cfg.extraOpts;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|