[Packages] Add custom firefox configuration.

With enterprise policies to selectively enable/disable things, and preinstall extensions

Also disable firefox config for aviallon
This commit is contained in:
Antoine Viallon 2022-04-04 20:11:28 +02:00
parent 5ae84ffe56
commit 71f5d703f2
Signed by: aviallon
GPG key ID: 186FC35EDEB25716
3 changed files with 78 additions and 0 deletions

View file

@ -154,6 +154,7 @@ in {
# programs.gnupg.agent.pinentryFlavor = "qt";
environment.systemPackages = with pkgs; [
myFirefox
chromium
p7zip
vlc

View file

@ -121,6 +121,8 @@ in
enableWideVine = true;
};
# chromium = self.ungoogled-chromium;
myFirefox = (import ./packages/firefox.nix { pkgs = self; inherit lib; });
})
];

75
packages/firefox.nix Normal file
View file

@ -0,0 +1,75 @@
{pkgs, lib,
...
}:
with lib;
let
genPrefList = {locked ? false}: prefs: concatStringsSep "\n" (
mapAttrsToList
(key: value: ''lockPref(${toString key}, ${builtins.toJSON value});'')
prefs
);
in pkgs.wrapFirefox pkgs.firefox-esr-unwrapped {
cfg = {
smartcardSupport = true;
enablePlasmaBrowserIntegration = true;
};
extraPolicies = {
CaptivePortal = true;
DisableFirefoxStudies = true;
DisablePocket = true;
DisableTelemetry = true;
DisableFirefoxAccounts = false;
FirefoxHome = {
Pocket = false;
Snippets = false;
};
HardwareAcceleration = true;
UserMessaging = {
ExtensionRecommendations = false;
SkipOnboarding = true;
WhatsNew = false;
MoreFromMozilla = false;
};
SSLVersionMin = "tls1.2";
SearchSuggestEnabled = true;
SearchEngines = {
Add = [
{
Name = "DuckDuckGo";
URLTemplate = "https://duckduckgo.com/?kp=1&k1=-1&kak=-1&kax=-1&kau=-1&kae=d&kaj=m&kam=osm&kav=1&kf=fw&q={searchTerms}";
Method = "GET";
IconURL = "https://duckduckgo.com/favicon.png";
Description = "Your privacy, simplified";
}
];
Default = "DuckDuckGo";
};
SupportMenu = {
Title = "Support";
URL = "mailto:antoine@lesviallon.fr";
AccessKey = "S";
};
Extensions = {
Install = [
"uBlock0@raymondhill.net"
];
};
ExtensionSettings = {
"uBlock0@raymondhill.net" = {
installation_mode = "force_installed";
install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
};
};
ExtensionUpdate = true;
};
extraPrefs = genPrefList { locked = true; } {
"intl.accept_languages" = "";
"widget.use-xdg-desktop-portal" = true;
"dom.event.contextmenu.enabled" = true;
"network.IDN_show_punycode" = true;
"plugins.enumerable_names" = true;
"security.identityblock.show_extended_validation" = true;
};
}