{ inputs, ... }: { flake-file.inputs = { zen-browser = { url = "github:youwen5/zen-browser-flake"; inputs.nixpkgs.follows = "nixpkgs"; }; }; flake.modules.homeManager.browser = { pkgs , lib , ... }: let mkExtension = shortId: guid: { name = guid; value = { install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi"; installation_mode = "normal_installed"; }; }; zen-pkg = inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.zen-browser-unwrapped; prefs = { "zen.tabs.vertical.right-side" = true; "zen.workspaces.force-container-workspace" = true; "zen.view.compact.enable-at-startup" = true; "zen.pinned-tab-manager.restore-pinned-tabs-to-pinned-url" = true; "zen.welcome-screen.seen" = true; "sidebar.visibility" = "hide-sidebar"; "privacy.fingerprintingProtection" = true; "privacy.globalprivacycontrol.was_ever_enabled" = true; "privacy.sanitize.clearOnShutdown.hasMigratedToNewPrefs3" = true; "privacy.trackingprotection.allow_list.convenience.enabled" = false; "privacy.trackingprotection.allow_list.hasMigratedCategoryPrefs" = true; "privacy.trackingprotection.allow_list.hasUserInteractedWithETPSettings" = true; "privacy.trackingprotection.emailtracking.enabled" = true; "privacy.trackingprotection.enabled" = true; "privacy.trackingprotection.socialtracking.enabled" = true; }; extensions = [ # To add additional extensions, find it on addons.mozilla.org, find # the short ID in the url (like https://addons.mozilla.org/en-US/firefox/addon/!SHORT_ID!/) # Then go to https://addons.mozilla.org/api/v5/addons/addon/!SHORT_ID!/ to get the guid (mkExtension "ublock-origin" "uBlock0@raymondhill.net") (mkExtension "darkreader" "addon@darkreader.org") (mkExtension "bitwarden-password-manager" "{446900e4-71c2-419f-a6a7-df9c091e268b}") # ... ]; in { home.packages = [ ( pkgs.wrapFirefox zen-pkg { extraPrefs = lib.concatLines ( lib.mapAttrsToList ( name: value: ''lockPref(${lib.strings.toJSON name}, ${lib.strings.toJSON value});'' ) prefs ); extraPolicies = { DisableTelemetry = true; ExtensionSettings = builtins.listToAttrs extensions; SearchEngines = { Default = "ddg"; Add = [ { Name = "nixpkgs packages"; URLTemplate = "https://search.nixos.org/packages?query={searchTerms}"; IconURL = "https://wiki.nixos.org/favicon.ico"; Alias = "@np"; } ]; }; }; } ) ]; }; }