1
1
Fork 0

chromium: add policies and switch to google-chrome

Signed-off-by: Myned <dev@bjork.tech>
This commit is contained in:
Myned 2024-12-21 13:41:28 -05:00
parent 9e97d1518e
commit 752e728c75
Signed by: myned
GPG key ID: C7224454F7881A34

View file

@ -1,35 +1,309 @@
{ {
config, config,
lib, lib,
pkgs,
... ...
}: }:
with lib; let with lib; let
cfg = config.custom.programs.chromium; cfg = config.custom.programs.chromium;
in { in {
options.custom.programs.chromium.enable = mkOption {default = false;}; options.custom.programs.chromium = {
enable = mkOption {default = false;};
package = mkOption {default = pkgs.google-chrome;};
};
config.home-manager.users.${config.custom.username} = mkIf cfg.enable { config = mkIf cfg.enable {
# https://wiki.nixos.org/wiki/Chromium # https://wiki.nixos.org/wiki/Chromium
# https://www.chromium.org/chromium-projects # https://www.chromium.org/chromium-projects
programs.chromium = { programs.chromium = {
enable = true; enable = true;
commandLineArgs = [ # https://chromeenterprise.google/policies/
"--enable-features=OverlayScrollbar,ChromeRefresh2023,TabGroupsSave,TouchpadOverscrollHistoryNavigation" #?? chrome://policy
]; extraOpts = {
# HACK: Extensions are force-installed with programs.chromium.extensions option
extensions = [ # https://support.google.com/chrome/a/answer/9867568
#"ajopnjidmegmdimjlfnijceegpefgped" # BetterTTV # https://chromeenterprise.google/policies/#ExtensionSettings
#"nngceckbapebfimnlniiiahkandclblb" # Bitwarden ExtensionSettings = listToAttrs (map (id: {
#"enamippconapkdmgfgjchkhakpfinmaj" # DeArrow name = id;
#"fnaicdffflnofjppbagibeoednhnbjhg" # floccus value = {
#"bnomihfieiccainjcjblhegjgglakjdd" # Improve YouTube installation_mode = "normal_installed";
#"mnjggcdmjocbbbhaepdhchncahnbgone" # SponsorBlock update_url = "https://clients2.google.com/service/update2/crx";
#"clngdbkpkpeebahjckkjfobafhncgmne" # Stylus };
#"kfidecgcdjjfpeckbblhmfkhmlgecoff" # Svelte DevTools }) (optionals config.custom.default [
#"nplimhmoanghlebhdiboeellhgmgommi" # Tab Groups Extension #// "cjpalhdlnbpafiamejdnhcphjbkeiagm" # uBlock Origin
"ddkjiahejlhfcafbddmgiahcphecmpfh" # uBlock Origin Lite "ddkjiahejlhfcafbddmgiahcphecmpfh" # uBlock Origin Lite
]
++ optionals config.custom.full [
"khgocmkkpikpnmmkgmdnfckapcdkgfaf" # 1Password Beta
#// "ajopnjidmegmdimjlfnijceegpefgped" # BetterTTV
#// "nngceckbapebfimnlniiiahkandclblb" # Bitwarden
#// "enamippconapkdmgfgjchkhakpfinmaj" # DeArrow
#// "fnaicdffflnofjppbagibeoednhnbjhg" # floccus
#// "bnomihfieiccainjcjblhegjgglakjdd" # Improve YouTube
"mnjggcdmjocbbbhaepdhchncahnbgone" # SponsorBlock
"clngdbkpkpeebahjckkjfobafhncgmne" # Stylus
#// "kfidecgcdjjfpeckbblhmfkhmlgecoff" # Svelte DevTools
#// "nplimhmoanghlebhdiboeellhgmgommi" # Tab Groups Extension
"enboaomnljigfhfjfoalacienlhjlfil" # UnTrap for YouTube
]));
# https://chromeenterprise.google/policies/#DefaultSearchProvider
DefaultSearchProviderEnabled = true;
DefaultSearchProviderKeyword = "g";
DefaultSearchProviderName = "Google";
DefaultSearchProviderSearchURL = "{google:baseURL}search?q={searchTerms}&{google:RLZ}{google:originalQueryForSuggestion}{google:assistedQueryStats}{google:searchFieldtrialParameter}{google:searchClient}{google:sourceId}ie={inputEncoding}";
DefaultSearchProviderSuggestURL = "{google:baseURL}complete/search?output=chrome&q={searchTerms}";
# https://chromeenterprise.google/policies/#SiteSearchSettings
SiteSearchSettings = [
{
name = "Amazon";
shortcut = "a";
url = "https://www.amazon.com/s?k={searchTerms}";
}
{
name = "ArchWiki";
shortcut = "aw";
url = "https://wiki.archlinux.org/index.php?search={searchTerms}";
}
{
name = "Brave";
shortcut = "b";
url = "https://search.brave.com/search?q={searchTerms}";
}
{
name = "DuckDuckGo";
shortcut = "d";
url = "https://duckduckgo.com/?q={searchTerms}";
}
{
name = "Docker Hub";
shortcut = "dh";
url = "https://hub.docker.com/search?q={searchTerms}";
}
{
name = "e621";
shortcut = "e";
url = "https://e621.net/posts?tags={searchTerms}";
}
{
name = "Element Issues";
shortcut = "ei";
url = "https://github.com/element-hq/element-web/issues?q=is%3Aissue+is%3Aopen+{searchTerms}";
}
{
name = "Flathub";
shortcut = "fh";
url = "https://flathub.org/apps/search?q={searchTerms}";
}
{
name = "GitHub";
shortcut = "gh";
url = "https://github.com/search?q={searchTerms}";
}
{
name = "Home Manager Issues";
shortcut = "hi";
url = "https://github.com/nix-community/home-manager/issues?q=is%3Aissue+is%3Aopen+{searchTerms}";
}
{
name = "Home Manager Options";
shortcut = "ho";
url = "https://home-manager-options.extranix.com/?query={searchTerms}&release=master";
}
{
name = "Hyprland Issues";
shortcut = "hyi";
url = "https://github.com/hyprwm/Hyprland/issues?q=is%3Aissue+is%3Aopen+{searchTerms}";
}
{
name = "i3 Issues";
shortcut = "ii";
url = "https://github.com/i3/i3/issues?q=is%3Aissue+is%3Aopen+{searchTerms}";
}
{
name = "Lutris";
shortcut = "l";
url = "https://lutris.net/games?q={searchTerms}";
}
{
name = "Lix Issues";
shortcut = "li";
url = "https://git.lix.systems/lix-project/lix/issues?state=open&q={searchTerms}";
}
{
name = "Mozilla Web Docs";
shortcut = "mdn";
url = "https://developer.mozilla.org/en-US/search?q={searchTerms}";
}
{
name = "MyNixOS Options";
shortcut = "mno";
url = "https://mynixos.com/search?q=option+{searchTerms}";
}
{
name = "Nix Dev";
shortcut = "nd";
url = "https://nix.dev/manual/nix/latest?search={searchTerms}";
}
{
name = "NixOS Flakes";
shortcut = "nf";
url = "https://search.nixos.org/flakes?channel=unstable&query={searchTerms}";
}
{
name = "Nix Hub";
shortcut = "nh";
url = "https://www.nixhub.io/search?q={searchTerms}";
}
{
name = "NixOS Nixpkgs Issues";
shortcut = "ni";
url = "https://github.com/NixOS/nixpkgs/issues?q=is%3Aissue+is%3Aopen+{searchTerms}";
}
{
name = "NixOS Options";
shortcut = "no";
url = "https://search.nixos.org/options?channel=unstable&query={searchTerms}";
}
{
name = "Noogle Dev";
shortcut = "nod";
url = "https://noogle.dev/q?term={searchTerms}";
}
{
name = "NixOS Packages";
shortcut = "np";
url = "https://search.nixos.org/packages?channel=unstable&query={searchTerms}";
}
{
name = "Nix PR";
shortcut = "npr";
url = "https://nixpk.gs/pr-tracker.html?pr={searchTerms}";
}
{
name = "NixOS Wiki";
shortcut = "nw";
url = "https://wiki.nixos.org/w/index.php?search={searchTerms}";
}
{
name = "Piped";
shortcut = "p";
url = "https://piped.bjork.tech/results?search_query={searchTerms}";
}
{
name = "PCGamingWiki";
shortcut = "pc";
url = "https://www.pcgamingwiki.com/w/index.php?search={searchTerms}";
}
{
name = "ProtonDB";
shortcut = "pdb";
url = "https://www.protondb.com/search?q={searchTerms}";
}
{
name = "PyPI";
shortcut = "pip";
url = "https://pypi.org/search/?q={searchTerms}";
}
{
name = "Reddit";
shortcut = "r";
url = "https://www.google.com/search?q=site%3Areddit.com+{searchTerms}";
}
{
name = "SearXNG";
shortcut = "s";
url = "https://search.bjork.tech/search?q={searchTerms}";
}
{
name = "Sway Issues";
shortcut = "si";
url = "https://github.com/swaywm/sway/issues?q=is%3Aissue+is%3Aopen+{searchTerms}";
}
{
name = "Wikipedia";
shortcut = "w";
url = "https://en.wikipedia.org/w/index.php?search={searchTerms}";
}
{
name = "Wolfram Alpha";
shortcut = "wa";
url = "https://www.wolframalpha.com/input?i={searchTerms}";
}
{
name = "Walker Issues";
shortcut = "wi";
url = "https://github.com/abenz1267/walker/issues?q=is%3Aissue+is%3Aopen+{searchTerms}";
}
{
name = "YouTube";
shortcut = "y";
url = "https://www.youtube.com/results?search_query={searchTerms}";
}
]; ];
}; };
}; };
home-manager.users.${config.custom.username} = {
programs.chromium = {
enable = true;
package = cfg.package;
# https://stackoverflow.com/questions/69363637/how-to-write-argument-for-chrome-chromiums-enable-features-flag
#?? https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/about_flags.cc
commandLineArgs = let
features = concatStringsSep "," [
"OverlayScrollbar"
# https://wiki.archlinux.org/title/Chromium#Touchpad_Gestures_for_Navigation
"TouchpadOverscrollHistoryNavigation"
];
in
[
"--enable-features=${features}"
]
++ optionals (cfg.package.pname == "brave") [
"--password-store=auto" # Fix secrets defaulting to kwallet
];
};
};
};
} }