2016-12-10 20:34:54 +01:00
|
|
|
{ config, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.programs.chromium;
|
|
|
|
|
|
|
|
defaultProfile = filterAttrs (k: v: v != null) {
|
|
|
|
HomepageLocation = cfg.homepageLocation;
|
2022-01-15 19:00:12 +01:00
|
|
|
DefaultSearchProviderEnabled = cfg.defaultSearchProviderEnabled;
|
2016-12-10 20:34:54 +01:00
|
|
|
DefaultSearchProviderSearchURL = cfg.defaultSearchProviderSearchURL;
|
|
|
|
DefaultSearchProviderSuggestURL = cfg.defaultSearchProviderSuggestURL;
|
2020-02-24 00:34:56 +01:00
|
|
|
ExtensionInstallForcelist = cfg.extensions;
|
2016-12-10 20:34:54 +01:00
|
|
|
};
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
programs.chromium = {
|
|
|
|
enable = mkEnableOption "<command>chromium</command> policies";
|
|
|
|
|
|
|
|
extensions = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
description = ''
|
|
|
|
List of chromium extensions to install.
|
|
|
|
For list of plugins ids see id in url of extensions on
|
|
|
|
<link xlink:href="https://chrome.google.com/webstore/category/extensions">chrome web store</link>
|
2020-02-24 00:34:56 +01: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
|
2020-10-16 23:04:06 +02:00
|
|
|
<link xlink:href="https://cloud.google.com/docs/chrome-enterprise/policies/?policy=ExtensionInstallForcelist">ExtensionInstallForcelist</link>
|
2020-02-24 00:34:56 +01:00
|
|
|
for additional details.
|
2016-12-10 20:34:54 +01:00
|
|
|
'';
|
|
|
|
default = [];
|
2021-10-03 18:06:03 +02:00
|
|
|
example = literalExpression ''
|
2016-12-10 20:34:54 +01:00
|
|
|
[
|
|
|
|
"chlffgpmiacpedhhbkiomidkjlcfhogd" # pushbullet
|
|
|
|
"mbniclmhobmnbdlbpiphghaielnnpgdp" # lightshot
|
|
|
|
"gcbommkclmclpchllfjekcdonpmejbdp" # https everywhere
|
2018-02-23 20:00:26 +01:00
|
|
|
"cjpalhdlnbpafiamejdnhcphjbkeiagm" # ublock origin
|
2016-12-10 20:34:54 +01:00
|
|
|
]
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
homepageLocation = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
description = "Chromium default homepage";
|
|
|
|
default = null;
|
|
|
|
example = "https://nixos.org";
|
|
|
|
};
|
|
|
|
|
2022-01-15 19:00:12 +01:00
|
|
|
defaultSearchProviderEnabled = mkOption {
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
description = "Enable the default search provider.";
|
|
|
|
default = null;
|
|
|
|
example = true;
|
|
|
|
};
|
|
|
|
|
2016-12-10 20:34:54 +01:00
|
|
|
defaultSearchProviderSearchURL = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
description = "Chromium default search provider url.";
|
|
|
|
default = null;
|
|
|
|
example =
|
2018-02-22 18:55:33 +01:00
|
|
|
"https://encrypted.google.com/search?q={searchTerms}&{google:RLZ}{google:originalQueryForSuggestion}{google:assistedQueryStats}{google:searchFieldtrialParameter}{google:searchClient}{google:sourceId}{google:instantExtendedEnabledParameter}ie={inputEncoding}";
|
2016-12-10 20:34:54 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
defaultSearchProviderSuggestURL = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
description = "Chromium default search provider url for suggestions.";
|
|
|
|
default = null;
|
|
|
|
example =
|
|
|
|
"https://encrypted.google.com/complete/search?output=chrome&q={searchTerms}";
|
|
|
|
};
|
|
|
|
|
|
|
|
extraOpts = mkOption {
|
|
|
|
type = types.attrs;
|
|
|
|
description = ''
|
2020-05-24 06:09:01 +02:00
|
|
|
Extra chromium policy options. A list of available policies
|
|
|
|
can be found in the Chrome Enterprise documentation:
|
|
|
|
<link xlink:href="https://cloud.google.com/docs/chrome-enterprise/policies/">https://cloud.google.com/docs/chrome-enterprise/policies/</link>
|
|
|
|
Make sure the selected policy is supported on Linux and your browser version.
|
2016-12-10 20:34:54 +01:00
|
|
|
'';
|
|
|
|
default = {};
|
2021-10-03 18:06:03 +02:00
|
|
|
example = literalExpression ''
|
2020-05-24 06:09:01 +02:00
|
|
|
{
|
|
|
|
"BrowserSignin" = 0;
|
|
|
|
"SyncDisabled" = true;
|
|
|
|
"PasswordManagerEnabled" = false;
|
|
|
|
"SpellcheckEnabled" = true;
|
|
|
|
"SpellcheckLanguage" = [
|
|
|
|
"de"
|
|
|
|
"en-US"
|
|
|
|
];
|
|
|
|
}
|
|
|
|
'';
|
2016-12-10 20:34:54 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
2018-02-23 20:00:26 +01:00
|
|
|
# for chromium
|
2016-12-10 20:34:54 +01:00
|
|
|
environment.etc."chromium/policies/managed/default.json".text = builtins.toJSON defaultProfile;
|
|
|
|
environment.etc."chromium/policies/managed/extra.json".text = builtins.toJSON cfg.extraOpts;
|
2018-02-23 20:00:26 +01:00
|
|
|
# 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;
|
2021-07-06 05:18:05 +02:00
|
|
|
# for brave
|
2021-07-05 10:48:50 +02:00
|
|
|
environment.etc."brave/policies/managed/default.json".text = builtins.toJSON defaultProfile;
|
|
|
|
environment.etc."brave/policies/managed/extra.json".text = builtins.toJSON cfg.extraOpts;
|
2016-12-10 20:34:54 +01:00
|
|
|
};
|
|
|
|
}
|