From 015a062c2ac64bd64c0dcf31ac402020fad8459e Mon Sep 17 00:00:00 2001 From: Jade Date: Wed, 22 Nov 2023 00:22:14 +0100 Subject: [PATCH] Configured firefox declaratively --- modules/desktop/default.nix | 3 +- modules/desktop/firefox.nix | 250 ++++++++++++++++++++++++++++++++++++ 2 files changed, 252 insertions(+), 1 deletion(-) create mode 100644 modules/desktop/firefox.nix diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index b508479..979dcdf 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -28,6 +28,7 @@ in with lib; { ./specific-hardware ./evremap.nix ./xmonad.nix + ./firefox.nix ]; i18n.inputMethod = { @@ -115,7 +116,7 @@ in with lib; { vlc mpv evince nomacs # from environment.systemPackages cleanup - font-manager xdotool xorg.xwininfo gparted librewolf firefox uhk-agent + font-manager xdotool xorg.xwininfo gparted uhk-agent cool-retro-term xdg-desktop-portal-gtk obsidian zettlr virt-manager ddccontrol-db firebird-emu gitg gpick qdirstat ffmpeg_5 diff --git a/modules/desktop/firefox.nix b/modules/desktop/firefox.nix new file mode 100644 index 0000000..847b1b3 --- /dev/null +++ b/modules/desktop/firefox.nix @@ -0,0 +1,250 @@ +{ ... }: { + home-manager.users.jade = { pkgs, ... }: { + programs.firefox = { + # TODO: tridactyl? + enable = true; + policies = { + DefaultDownloadDirectory = "\${home}/Downloads"; + Extensions.Install = [ + "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin" + "https://addons.mozilla.org/firefox/downloads/latest/privacy-badger17" + "https://addons.mozilla.org/firefox/downloads/latest/torproject-snowflake" + "https://addons.mozilla.org/firefox/downloads/latest/bitwarden-password-manager" + "https://addons.mozilla.org/firefox/downloads/latest/terms-of-service-didnt-read" + ]; + }; + profiles.jader= { + search = { + force = true; + default = "duckduckgo"; + engines = { + "Nix Packages" = { + urls = [{ + template = "https://search.nixos.org/packages"; + params = [ + { name = "query"; value = "{searchTerms}"; } + ]; + }]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "pkgs" ]; + }; + "Nix Options" = { + urls = [{ + template = "https://search.nixos.org/options"; + params = [ + { name = "query"; value = "{searchTerms}"; } + ]; + }]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "opts" ]; + }; + "Home manager Options" = { + urls = [{ + template = "https://mipmip.github.io/home-manager-option-search/"; + params = [ + { name = "query"; value = "{searchTerms}"; } + ]; + }]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "hm" ]; + }; + "NixOS Wiki" = { + urls = [{ + template = "https://nixos.wiki/index.php?title=Special:Search&search={searchTerms}&namespace=0"; + }]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "nxwk" ]; + }; + "lib.rs" = { + urls = [{ + template = "https://lib.rs/search"; + params = [ + { name = "q"; value = "{searchTerms}"; } + ]; + }]; + icon = "https://lib.rs/favicon.png"; + definedAliases = [ "libs" ]; + }; + "rust docs" = { + urls = [{ + template = "https://docs.rs/releases/search"; + params = [ + { name = "query"; value = "{searchTerms}"; } + ]; + }]; + icon = "https://docs.rs/-/static/favicon.ico"; + definedAliases = [ "docs" ]; + }; + "rust std docs" = { + urls = [{ + template = "https://docs.rust-lang.org/std/index.html"; + params = [ + { name = "search"; value = "{searchTerms}"; } + ]; + }]; + icon = "https://doc.rust-lang.org/favicon.ico"; + definedAliases = [ "std" ]; + }; + "duckduckgo" = { + urls = [{ + template = "https://duckduckgo.com/"; + params = [ + { name = "q"; value = "{searchTerms}"; } + ]; + }]; + icon = "https://duckduckgo.com/favicon.ico"; + }; + }; + }; + settings = { + "devtools.editor.keymap" = "vim"; + "devtools.toolbox.host" = "right"; + "webgl.disabled" = false; + "image.jxl.enabled" = true; + "browser.urlbar.decodeURLsOnCopy" = true; + "browser.urlbar.unitConversion.enabled" = true; + "browser.urlbar.suggest.calculator" = true; + "browser.compactmode.show" = true; + "browser.uidensity" = 1; + "screenshots.browser.component.enabled" = true; + "browser.aboutConfig.showWarning" = false; + "browser.aboutwelcome.showModal" = false; + "browser.preferences.moreFromMozilla" = false; + "identity.fxaccounts.enabled" = false; + "browser.tabs.firefox-view" = false; + "browser.tabs.firefox-view-next" = false; + + "geo.provider.network.logging.enabled" = true; + "extensions.getAddons.showPane" = false; + "extensions.htmlaboutaddons.recommendations.enabled" = false; + "browser.discovery.enabled" = false; + "browser.shopping.experience2023.enabled" = false; + "datareporting.policy.dataSubmissionEnabled" = false; + "datareporting.healthreport.uploadEnabled" = false; + "toolkit.telemetry.unified" = false; + "toolkit.telemetry.enabled" = false; + "toolkit.telemetry.server" = "data:,"; + "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; + "toolkit.telemetry.coverage.opt-out" = true; + "toolkit.coverage.opt-out" = true; + "toolkit.coverage.endpoint.base" = ""; + "browser.ping-centre.telemetry" = false; + "browser.newtabpage.activity-stream.feeds.telemetry" = false; + "browser.newtabpage.activity-stream.telemetry" = false; + "app.shield.optoutstudies.enabled" = false; + "app.normandy.enabled" = false; + "app.normandy.api_url" = ""; + + "browser.safebrowsing.malware.enabled" = false; + "browser.safebrowsing.phishing.enabled" = false; + "browser.safebrowsing.downloads.enabled" = false; + "browser.safebrowsing.downloads.remote.enabled" = false; + "browser.safebrowsing.downloads.remote.url" = ""; + "browser.safebrowsing.downloads.remote.block_potentially_unwanted" = false; + "browser.safebrowsing.downloads.remote.block_uncommon" = false; + "browser.safebrowsing.allowOverride" = false; + + "network.prefetch-next" = false; + "network.dns.disablePrefetch" = true; + "network.dns.disablePrefetchFromHTTPS" = true; + "network.predictor.enabled" = false; + "network.predictor.enable-prefetch" = false; + "network.http.speculative-parallel-limit" = 0; + "browser.places.speculativeConnect.enabled" = false; + "browser.send_pings" = false; + + "browser.urlbar.pocket.featureGate" = false; + "browser.urlbar.weather.featureGate" = false; + "browser.urlbar.speculativeConnect.enabled" = false; + "browser.urlbar.suggest.quicksuggest.nonsponsored" = false; + "browser.urlbar.suggest.quicksuggest.sponsored" = false; + "browser.search.suggest.enabled" = false; + "browser.urlbar.suggest.searches" = false; + "browser.urlbar.trending.featureGate" = false; + + "security.ssl.require_safe_negotiation" = true; + "security.remote_settings.crlite_filters.enabled" = true; + "security.pki.crlite_mode" = 2; + + "dom.security.https_only_mode" = true; + "dom.security.https_only_mode_pbm" = true; + "security.ssl.treat_unsafe_negotiation_as_broken" = true; + "browser.xul.error_pages.expert_bad_cert" = true; + "network.http.referer.XOriginTrimmingPolicy" = 2; + + "privacy.userContext.enabled" = true; + "privacy.userContext.ui.enabled" = true; + "privacy.userContext.newTabContainerOnLeftClick.enabled" = true; + + "dom.disable_window_move_resize" = true; + + "browser.uitour.enabled" = false; + + "browser.uitour.url" = ""; + "permissions.manager.defaultsUrl" = ""; + "webchannel.allowObject.urlWhitelist" = ""; + + "network.IDN_show_punycode" = true; + "pdfjs.disabled" = false; + "pdfjs.enableScripting" = false; + "browser.tabs.searchclipboardfor.middleclick" = false; + "browser.download.useDownloadDir" = false; + "browser.download.alwaysOpenPanel" = false; + + "browser.download.manager.addToRecentDocs" = false; + + "browser.download.always_ask_before_handling_new_types" = true; + "privacy.resistFingerprinting" = true; + "privacy.resistFingerprinting.pbmode" = true; + "privacy.window.maxInnerWidth" = 1600; + "privacy.window.maxInnerHeight" = 900; + "privacy.resistFingerprinting.block_mozAddonManager" = true; + "privacy.resistFingerprinting.letterboxing" = true; + "privacy.resistFingerprinting.letterboxing.dimensions" = ""; + "widget.non-native-theme.enabled" = true; + "browser.link.open_newwindow" = 3; + "browser.link.open_newwindow.restriction" = 0; + "signon.rememberSignons" = false; + "dom.popup_allowed_events" = "click dblclick mousedown pointerdown"; + "browser.pagethumbnails.capturing_disabled" = true; + + "geo.enabled" = false; + "full-screen-api.enabled" = false; + "permissions.default.geo" = 0; + "permissions.default.camera" = 0; + "permissions.default.microphone" = 0; + "permissions.default.desktop-notification" = 0; + "permissions.default.xr" = 0; + + "browser.newtabpage.pinned" = [ + { + title = "Katzencafé"; + url = "https://ck.katzen.cafe"; + } + { + title = "Katzenschmiede"; + url = "https://forge.katzen.cafe"; + } + { + title = "CatPad"; + url = "https://pad.katzen.cafe"; + } + { + title = "Katzenwolke"; + url = "https://wolke.katzen.cafe"; + } + { + title = "Penpot"; + url = "https://design.katzen.cafe"; + } + ]; + }; + }; + }; + }; +}