|
|
@@ -1,203 +1,97 @@
|
|
|
-{
|
|
|
- inputs,
|
|
|
- pkgs,
|
|
|
- lib,
|
|
|
- config,
|
|
|
- ...
|
|
|
+{ inputs
|
|
|
+, config
|
|
|
+, ...
|
|
|
}:
|
|
|
|
|
|
let
|
|
|
- locked = value: {
|
|
|
- Value = value;
|
|
|
- Status = "locked";
|
|
|
- };
|
|
|
+ mkExtensionSettings = builtins.mapAttrs (_: pluginId: {
|
|
|
+ install_url = "https://addons.mozilla.org/firefox/downloads/latest/${pluginId}/latest.xpi";
|
|
|
+ installation_mode = "force_installed";
|
|
|
+ });
|
|
|
in
|
|
|
|
|
|
{
|
|
|
imports = [
|
|
|
- inputs.zen-browser.homeModules.twilight
|
|
|
+ inputs.zen-browser.homeModules.beta
|
|
|
];
|
|
|
|
|
|
programs.zen-browser.policies = {
|
|
|
- ExtensionSettings = {
|
|
|
- "{d7742d87-e61d-4b78-b8a1-b469842139fa}" = {
|
|
|
- install_url = "https://addons.mozilla.org/firefox/downloads/latest/vimium-ff/latest.xpi";
|
|
|
- installation_mode = "force_installed";
|
|
|
- };
|
|
|
-
|
|
|
- "[email protected]" = {
|
|
|
- install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
|
|
|
- installation_mode = "force_installed";
|
|
|
- };
|
|
|
-
|
|
|
- "{7be2ba16-0f1e-4d93-9ebc-5164397477a9}" = {
|
|
|
- install_url = "https://addons.mozilla.org/firefox/downloads/latest/videospeed/latest.xpi";
|
|
|
- installation_mode = "force_installed";
|
|
|
- };
|
|
|
-
|
|
|
- "[email protected]" = {
|
|
|
- install_url = "https://addons.mozilla.org/firefox/downloads/latest/proton-pass/latest.xpi";
|
|
|
- installation_mode = "force_installed";
|
|
|
- };
|
|
|
-
|
|
|
- "addon@simplelogin" = {
|
|
|
- install_url = "https://addons.mozilla.org/firefox/downloads/latest/simplelogin/latest.xpi";
|
|
|
- installation_mode = "force_installed";
|
|
|
- };
|
|
|
-
|
|
|
- "[email protected]" = {
|
|
|
- install_url = "https://addons.mozilla.org/firefox/downloads/latest/alby/latest.xpi";
|
|
|
- installation_mode = "force_installed";
|
|
|
- };
|
|
|
+ AutofillAddressEnabled = false;
|
|
|
+ AutofillCreditCardEnabled = false;
|
|
|
+ DisableAppUpdate = true;
|
|
|
+ DisableFeedbackCommands = true;
|
|
|
+ DisableFirefoxStudies = true;
|
|
|
+ DisablePocket = true;
|
|
|
+ DisableTelemetry = true;
|
|
|
+ DontCheckDefaultBrowser = true;
|
|
|
+ NoDefaultBookmarks = true;
|
|
|
+ OfferToSaveLogins = false;
|
|
|
+ EnableTrackingProtection = {
|
|
|
+ Value = true;
|
|
|
+ Locked = true;
|
|
|
+ Cryptomining = true;
|
|
|
+ Fingerprinting = true;
|
|
|
+ };
|
|
|
|
|
|
- "[email protected]" = {
|
|
|
- install_url = "https://addons.mozilla.org/firefox/downloads/latest/darkreader/latest.xpi";
|
|
|
- installation_mode = "force_installed";
|
|
|
- };
|
|
|
+ ExtensionSettings = mkExtensionSettings {
|
|
|
+ "{d7742d87-e61d-4b78-b8a1-b469842139fa}" = "vimium-ff";
|
|
|
+ "[email protected]" = "ublock-origin";
|
|
|
+ "{7be2ba16-0f1e-4d93-9ebc-5164397477a9}" = "videospeed";
|
|
|
+ "addon@simplelogin" = "simplelogin";
|
|
|
+ "[email protected]" = "alby";
|
|
|
+ "[email protected]" = "darkreader";
|
|
|
};
|
|
|
};
|
|
|
|
|
|
programs.zen-browser = {
|
|
|
enable = true;
|
|
|
-
|
|
|
- # NOTE: Zen Browser seems currently to ignore Enterprise Policies
|
|
|
- # See: https://github.com/zen-browser/desktop/discussions/2195
|
|
|
- # All actual configuration is done via Preferences instead
|
|
|
- policies = {
|
|
|
- Preferences = builtins.mapAttrs (_: locked) {
|
|
|
- # Original preferences
|
|
|
- "browser.tabs.warnOnClose" = false;
|
|
|
- "media.videocontrols.picture-in-picture.video-toggle.enabled" = true;
|
|
|
-
|
|
|
- # AutofillAddressEnabled = false
|
|
|
- "extensions.formautofill.addresses.enabled" = false;
|
|
|
- "extensions.formautofill.addresses.capture.enabled" = false;
|
|
|
-
|
|
|
- # AutofillCreditCardEnabled = false
|
|
|
- "extensions.formautofill.creditCards.enabled" = false;
|
|
|
- "extensions.formautofill.creditCards.available" = false;
|
|
|
-
|
|
|
- # DisableAppUpdate = true
|
|
|
- "app.update.enabled" = false;
|
|
|
- "app.update.auto" = false;
|
|
|
- "app.update.service.enabled" = false;
|
|
|
-
|
|
|
- # DisableFeedbackCommands = true
|
|
|
- "browser.chrome.toolbar_tips" = false;
|
|
|
-
|
|
|
- # DisableFirefoxStudies = true
|
|
|
- "app.shield.optoutstudies.enabled" = false;
|
|
|
- "app.normandy.enabled" = false;
|
|
|
- "app.normandy.api_url" = "";
|
|
|
-
|
|
|
- # DisablePocket = true
|
|
|
- "extensions.pocket.enabled" = false;
|
|
|
- "extensions.pocket.api" = "";
|
|
|
- "extensions.pocket.oAuthConsumerKey" = "";
|
|
|
- "extensions.pocket.site" = "";
|
|
|
-
|
|
|
- # DisableTelemetry = true
|
|
|
- "toolkit.telemetry.enabled" = false;
|
|
|
- "toolkit.telemetry.unified" = false;
|
|
|
- "toolkit.telemetry.server" = "";
|
|
|
- "toolkit.telemetry.archive.enabled" = false;
|
|
|
- "toolkit.telemetry.newProfilePing.enabled" = false;
|
|
|
- "toolkit.telemetry.shutdownPingSender.enabled" = false;
|
|
|
- "toolkit.telemetry.updatePing.enabled" = false;
|
|
|
- "toolkit.telemetry.bhrPing.enabled" = false;
|
|
|
- "toolkit.telemetry.firstShutdownPing.enabled" = false;
|
|
|
- "datareporting.healthreport.uploadEnabled" = false;
|
|
|
- "datareporting.policy.dataSubmissionEnabled" = false;
|
|
|
- "browser.ping-centre.telemetry" = false;
|
|
|
- "browser.newtabpage.activity-stream.feeds.telemetry" = false;
|
|
|
- "browser.newtabpage.activity-stream.telemetry" = false;
|
|
|
-
|
|
|
- # DontCheckDefaultBrowser = true
|
|
|
- "browser.shell.checkDefaultBrowser" = false;
|
|
|
-
|
|
|
- # NoDefaultBookmarks = true
|
|
|
- "browser.bookmarks.restore_default_bookmarks" = false;
|
|
|
-
|
|
|
- # OfferToSaveLogins = false
|
|
|
- "signon.rememberSignons" = false;
|
|
|
- "signon.autofillForms" = false;
|
|
|
- "signon.generation.enabled" = false;
|
|
|
-
|
|
|
- # EnableTrackingProtection (supplementary preferences)
|
|
|
- "privacy.trackingprotection.enabled" = true;
|
|
|
- "privacy.trackingprotection.pbmode.enabled" = true;
|
|
|
- "privacy.trackingprotection.cryptomining.enabled" = true;
|
|
|
- "privacy.trackingprotection.fingerprinting.enabled" = true;
|
|
|
- "privacy.trackingprotection.socialtracking.enabled" = true;
|
|
|
-
|
|
|
- # Additional privacy hardening
|
|
|
- "browser.safebrowsing.malware.enabled" = false;
|
|
|
- "browser.safebrowsing.phishing.enabled" = false;
|
|
|
- "browser.safebrowsing.downloads.enabled" = false;
|
|
|
- "browser.safebrowsing.downloads.remote.enabled" = false;
|
|
|
- "network.captive-portal-service.enabled" = false;
|
|
|
- "network.connectivity-service.enabled" = false;
|
|
|
+ profiles."default" = {
|
|
|
+ containersForce = true;
|
|
|
+ containers = {
|
|
|
+ Personal = {
|
|
|
+ color = "purple";
|
|
|
+ icon = "fingerprint";
|
|
|
+ id = 1;
|
|
|
+ };
|
|
|
+
|
|
|
+ Development = {
|
|
|
+ color = "blue";
|
|
|
+ icon = "briefcase";
|
|
|
+ id = 2;
|
|
|
+ };
|
|
|
+
|
|
|
+ Shopping = {
|
|
|
+ color = "yellow";
|
|
|
+ icon = "dollarsign";
|
|
|
+ id = 3;
|
|
|
+ };
|
|
|
};
|
|
|
+
|
|
|
+ spacesForce = true;
|
|
|
+ spaces =
|
|
|
+ let
|
|
|
+ containers = config.programs.zen-browser.profiles."default".containers;
|
|
|
+ in
|
|
|
+ {
|
|
|
+ "Space" = {
|
|
|
+ id = "c6de089c-410d-4206-961d-ab11f988d40a";
|
|
|
+ icon = "🏠";
|
|
|
+ container = containers.Personal.id;
|
|
|
+ position = 1000;
|
|
|
+ };
|
|
|
+ "Work" = {
|
|
|
+ id = "cdd10fab-4fc5-494b-9041-325e5759195b";
|
|
|
+ icon = "🚀";
|
|
|
+ container = containers.Development.id;
|
|
|
+ position = 2000;
|
|
|
+ };
|
|
|
+ "Shopping" = {
|
|
|
+ id = "78aabdad-8aae-4fe0-8ff0-2a0c6c4ccc24";
|
|
|
+ icon = "💸";
|
|
|
+ container = containers.Shopping.id;
|
|
|
+ position = 3000;
|
|
|
+ };
|
|
|
+ };
|
|
|
};
|
|
|
};
|
|
|
-
|
|
|
- home.activation.zenExtensions = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
|
|
- ZEN_PROFILES_DIR="$HOME/Library/Application Support/zen/Profiles"
|
|
|
-
|
|
|
- if [ -d "$ZEN_PROFILES_DIR" ]; then
|
|
|
- # Extract extension settings from the configuration
|
|
|
- EXTENSIONS_CONFIG='${builtins.toJSON config.programs.zen-browser.policies.ExtensionSettings}'
|
|
|
-
|
|
|
- # Find all profile directories that contain zen-themes.json
|
|
|
- find "$ZEN_PROFILES_DIR" -maxdepth 1 -type d -name "*.*" | while read -r PROFILE_DIR; do
|
|
|
- # Skip profiles that don't have zen-themes.json
|
|
|
- if [ ! -f "$PROFILE_DIR/zen-themes.json" ]; then
|
|
|
- continue
|
|
|
- fi
|
|
|
- EXTENSIONS_DIR="$PROFILE_DIR/extensions"
|
|
|
- mkdir -p "$EXTENSIONS_DIR"
|
|
|
-
|
|
|
- echo "Managing extensions for profile: $(basename "$PROFILE_DIR")"
|
|
|
-
|
|
|
- # Create a temporary file to track which extensions should exist
|
|
|
- EXPECTED_EXTENSIONS=$(mktemp)
|
|
|
-
|
|
|
- # Parse the JSON configuration and download/update extensions
|
|
|
- echo "$EXTENSIONS_CONFIG" | ${pkgs.jq}/bin/jq -r 'to_entries[] | select(.value.installation_mode == "force_installed") | "\(.key) \(.value.install_url)"' | while read -r EXTENSION_ID INSTALL_URL; do
|
|
|
- EXTENSION_FILE="$EXTENSIONS_DIR/$EXTENSION_ID.xpi"
|
|
|
-
|
|
|
- # Add to expected extensions list
|
|
|
- echo "$EXTENSION_ID.xpi" >> "$EXPECTED_EXTENSIONS"
|
|
|
-
|
|
|
- echo "Installing extension: $EXTENSION_ID"
|
|
|
- ${pkgs.curl}/bin/curl -L -o "$EXTENSION_FILE" "$INSTALL_URL"
|
|
|
-
|
|
|
- if [ $? -eq 0 ]; then
|
|
|
- echo "Successfully installed: $EXTENSION_ID"
|
|
|
- else
|
|
|
- echo "Failed to install: $EXTENSION_ID"
|
|
|
- rm -f "$EXTENSION_FILE"
|
|
|
- fi
|
|
|
- done
|
|
|
-
|
|
|
- # Remove extensions that are no longer in the configuration
|
|
|
- if [ -f "$EXPECTED_EXTENSIONS" ]; then
|
|
|
- for EXISTING_XPI in "$EXTENSIONS_DIR"/*.xpi; do
|
|
|
- if [ -f "$EXISTING_XPI" ]; then
|
|
|
- BASENAME=$(basename "$EXISTING_XPI")
|
|
|
- if ! grep -Fxq "$BASENAME" "$EXPECTED_EXTENSIONS"; then
|
|
|
- echo "Removing unmanaged extension: $BASENAME"
|
|
|
- rm -f "$EXISTING_XPI"
|
|
|
- fi
|
|
|
- fi
|
|
|
- done
|
|
|
- fi
|
|
|
-
|
|
|
- # Cleanup temporary file
|
|
|
- rm -f "$EXPECTED_EXTENSIONS"
|
|
|
- done
|
|
|
- else
|
|
|
- echo "Zen Browser profiles directory not found: $ZEN_PROFILES_DIR"
|
|
|
- fi
|
|
|
- '';
|
|
|
}
|