70 lines
2.2 KiB
Nix
70 lines
2.2 KiB
Nix
{ pkgs, ... }:
|
|
|
|
let
|
|
policiesJson = builtins.toJSON {
|
|
policies = {
|
|
DisableTelemetry = true;
|
|
DisableFirefoxStudies = true;
|
|
DisablePocket = true;
|
|
DisableFirefoxAccounts = true;
|
|
|
|
ExtensionSettings = {
|
|
"{446900e4-71c2-419f-a6a7-df9c091e268b}" = {
|
|
install_url = "https://addons.mozilla.org/firefox/downloads/latest/bitwarden-password-manager/latest.xpi";
|
|
installation_mode = "force_installed";
|
|
};
|
|
"floccus@handmadeideas.org" = {
|
|
install_url = "https://addons.mozilla.org/firefox/downloads/latest/floccus/latest.xpi";
|
|
installation_mode = "force_installed";
|
|
};
|
|
"uBlock0@raymondhill.net" = {
|
|
install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
|
|
installation_mode = "force_installed";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
policiesFile = pkgs.writeText "librewolf-policies.json" policiesJson;
|
|
|
|
autoconfigLoader = pkgs.writeText "autoconfig.js" ''
|
|
pref("general.config.filename", "autoconfig.cfg");
|
|
pref("general.config.obscure_value", 0);
|
|
'';
|
|
|
|
autoconfigCfg = pkgs.writeText "autoconfig.cfg" ''
|
|
// First line must be a comment
|
|
lockPref("extensions.activeThemeID", "firefox-alpenglow@mozilla.org");
|
|
|
|
// Other stubborn prefs can go here if needed
|
|
lockPref("sidebar.revamp", true);
|
|
lockPref("sidebar.verticalTabs", true);
|
|
'';
|
|
|
|
in
|
|
{
|
|
system.activationScripts.postActivation.text = ''
|
|
APP_DIR="/Applications/LibreWolf.app"
|
|
if [ -d "$APP_DIR" ]; then
|
|
echo ">>> Applying LibreWolf Policies & AutoConfig..."
|
|
|
|
DIST_DIR="$APP_DIR/Contents/Resources/distribution"
|
|
mkdir -p "$DIST_DIR"
|
|
cp -f ${policiesFile} "$DIST_DIR/policies.json"
|
|
chmod 644 "$DIST_DIR/policies.json"
|
|
|
|
PREF_DIR="$APP_DIR/Contents/Resources/defaults/pref"
|
|
mkdir -p "$PREF_DIR"
|
|
cp -f ${autoconfigLoader} "$PREF_DIR/autoconfig.js"
|
|
chmod 644 "$PREF_DIR/autoconfig.js"
|
|
|
|
cp -f ${autoconfigCfg} "$APP_DIR/Contents/Resources/autoconfig.cfg"
|
|
chmod 644 "$APP_DIR/Contents/Resources/autoconfig.cfg"
|
|
|
|
echo ">>> Done."
|
|
else
|
|
echo ">>> LibreWolf.app not found. Skipping."
|
|
fi
|
|
'';
|
|
}
|