diff --git a/nixos/home/firefox/addons/addons.json b/nixos/home/firefox/addons/addons.json new file mode 100644 index 0000000..169ac58 --- /dev/null +++ b/nixos/home/firefox/addons/addons.json @@ -0,0 +1,14 @@ +[ + { + "slug": "600-sound-volume" + }, + { + "slug": "google-container" + }, + { + "slug": "checkmarks-web-ext" + }, + { + "slug": "opera-gx-witchcraft-purple" + } +] diff --git a/nixos/home/firefox/addons/default.nix b/nixos/home/firefox/addons/default.nix new file mode 100644 index 0000000..af986c9 --- /dev/null +++ b/nixos/home/firefox/addons/default.nix @@ -0,0 +1,48 @@ +{ fetchurl, lib, stdenv }@args: + +let + + buildFirefoxXpiAddon = lib.makeOverridable ({ stdenv ? args.stdenv + , fetchurl ? args.fetchurl, pname, version, addonId, url, sha256, meta, ... + }: + stdenv.mkDerivation { + name = "${pname}-${version}"; + + inherit meta; + + src = fetchurl { inherit url sha256; }; + + preferLocalBuild = true; + allowSubstitutes = true; + + buildCommand = '' + dst="$out/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}" + mkdir -p "$dst" + install -v -m644 "$src" "$dst/${addonId}.xpi" + ''; + }); + + packages = import ./generated-firefox-addons.nix { + inherit buildFirefoxXpiAddon fetchurl lib stdenv; + }; + +in packages // { + inherit buildFirefoxXpiAddon; + + bypass-paywalls-clean = let + version = "3.3.6.0"; + in buildFirefoxXpiAddon { + pname = "bypass-paywalls-clean"; + inherit version; + addonId = "magnolia@12.34"; + url = + "https://gitlab.com/magnolia1234/bpc-uploads/-/raw/master/bypass_paywalls_clean-${version}.xpi"; + sha256 = "sha256-nuWwx7a51WI1HPkATXMLi6UZiQo+YgWWCZZk54JPDIU="; + meta = with lib; { + homepage = "https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean"; + description = "Bypass Paywalls of (custom) news sites"; + license = licenses.mit; + platforms = platforms.all; + }; + }; +} diff --git a/nixos/home/firefox/addons/generated-firefox-addons.nix b/nixos/home/firefox/addons/generated-firefox-addons.nix new file mode 100644 index 0000000..44e40f6 --- /dev/null +++ b/nixos/home/firefox/addons/generated-firefox-addons.nix @@ -0,0 +1,80 @@ +{ buildFirefoxXpiAddon, fetchurl, lib, stdenv }: + { + "600-sound-volume" = buildFirefoxXpiAddon { + pname = "600-sound-volume"; + version = "1.5.3"; + addonId = "{c4b582ec-4343-438c-bda2-2f691c16c262}"; + url = "https://addons.mozilla.org/firefox/downloads/file/4133303/600_sound_volume-1.5.3.xpi"; + sha256 = "7045a812608338f95181459ae3e518bb51c8dc9a724a4083afb687d14075c304"; + meta = with lib; + { + homepage = "http://resourcefulman.net/"; + description = "Up to 600% volume boost"; + license = licenses.mpl20; + mozPermissions = [ "" "tabs" "activeTab" "storage" ]; + platforms = platforms.all; + }; + }; + "checkmarks-web-ext" = buildFirefoxXpiAddon { + pname = "checkmarks-web-ext"; + version = "1.6.1"; + addonId = "{bd97f89b-17ba-4539-9fec-06852d07f917}"; + url = "https://addons.mozilla.org/firefox/downloads/file/3594420/checkmarks_web_ext-1.6.1.xpi"; + sha256 = "c3ccf4b302ee96c9b883c4a1f7d26395ab4e276b976cab2d65c9cd898964e4f0"; + meta = with lib; + { + homepage = "https://github.com/tanwald/checkmarks"; + description = "Checks, sorts, formats bookmarks and loads favicons."; + license = licenses.gpl3; + mozPermissions = [ + "" + "bookmarks" + "browsingData" + "storage" + "tabs" + "webNavigation" + "webRequest" + "webRequestBlocking" + ]; + platforms = platforms.all; + }; + }; + "google-container" = buildFirefoxXpiAddon { + pname = "google-container"; + version = "1.5.4"; + addonId = "@contain-google"; + url = "https://addons.mozilla.org/firefox/downloads/file/3736912/google_container-1.5.4.xpi"; + sha256 = "47a7c0e85468332a0d949928d8b74376192cde4abaa14280002b3aca4ec814d0"; + meta = with lib; + { + homepage = "https://github.com/containers-everywhere/contain-google"; + description = "THIS IS NOT AN OFFICIAL ADDON FROM MOZILLA!\nIt is a fork of the Facebook Container addon.\n\nPrevent Google from tracking you around the web. The Google Container extension helps you take control and isolate your web activity from Google."; + license = licenses.mpl20; + mozPermissions = [ + "" + "contextualIdentities" + "cookies" + "management" + "tabs" + "webRequestBlocking" + "webRequest" + "storage" + ]; + platforms = platforms.all; + }; + }; + "opera-gx-witchcraft-purple" = buildFirefoxXpiAddon { + pname = "opera-gx-witchcraft-purple"; + version = "2.0"; + addonId = "{bf197856-a3c2-4280-84c5-9b556379b706}"; + url = "https://addons.mozilla.org/firefox/downloads/file/3522842/opera_gx_witchcraft_purple-2.0.xpi"; + sha256 = "aa3c6377b8571c42a3988de042694be70ec6a250a9aea7ae1cc262acdc9374eb"; + meta = with lib; + { + description = "inspired by Opera GX"; + license = licenses.cc-by-sa-30; + mozPermissions = []; + platforms = platforms.all; + }; + }; + } \ No newline at end of file diff --git a/nixos/home/firefox/firefox-gx.nix b/nixos/home/firefox/firefox-gx.nix new file mode 100644 index 0000000..6e7b20b --- /dev/null +++ b/nixos/home/firefox/firefox-gx.nix @@ -0,0 +1,36 @@ +{ lib, stdenvNoCC, fetchFromGitHub }: +let + pname = "firefox-gx"; + version = "8.4"; +in +stdenvNoCC.mkDerivation { + inherit pname version; + + src = fetchFromGitHub { + owner = "Godiesc"; + repo = pname; + rev = "v.${version}"; + sha256 = "sha256-Izb2dLIThLAXJ+Z6fNyRli3v3kV1upyDY0wA2VNVi+o="; + }; + + installPhase = '' + # Personal changes + sed -i 's/var(--fuchsia))/var(--purple))/' ./chrome/components/ogx_root-personal.css + + mv ./Extras/Tab-Shapes/ogx_tab-shapes.css ./chrome/components + rm ./user.js + mv ./Extras/Tab-Shapes/user.js ./ + sed -i 's/rounded_corner.chrome", true/rounded_corner.chrome", false/' ./user.js + sed -i 's/rounded_corner.wave", false/rounded_corner.wave", true/' ./user.js + + + mkdir -p $out + cp -r ./* $out + ''; + + meta = with lib; { + description = "Firefox Theme CSS to Opera GX Lovers "; + homepage = "https://github.com/Godiesc/firefox-gx"; + license = licenses.mspl; + }; +} diff --git a/nixos/home/firefox/main.nix b/nixos/home/firefox/main.nix new file mode 100644 index 0000000..af5d869 --- /dev/null +++ b/nixos/home/firefox/main.nix @@ -0,0 +1,158 @@ +{ config, pkgs, ... }: let + firefox-addons = pkgs.recurseIntoAttrs (pkgs.callPackage ./addons { }); + sound-volume = firefox-addons."600-sound-volume"; + + firefox-gx = pkgs.callPackage ./firefox-gx.nix { }; +in +{ + home.file = { + ".mozilla/firefox/matt/chrome".source = "${firefox-gx}/chrome"; + }; + + programs.firefox = { + enable = true; + profiles.matt = { + isDefault = true; + id = 0; + + extraConfig = builtins.readFile "${firefox-gx}/user.js"; + settings = { + # Open previous windows and tabs + "browser.startup.page" = 3; + + # Prefs + "browser.search.widget.inNavBar" = true; + "browser.toolbars.bookmarks.visibility" = "always"; + + # remove telemetry + "datareporting.policy.dataSubmissionEnabled" = false; + "datareporting.healthreport.uploadEnabled" = false; + "datareporting.healthreport.infoURL" = ""; + "dom.security.https_only_mode" = true; + + # remove first run and warning stuff + "datareporting.policy.firstRunURL" = ""; + "browser.aboutwelcome.enabled" = false; + "browser.aboutConfig.showWarning" = false; + + # Disable firefox autofill + "signon.rememberSignons" = false; + "extensions.formautofill.addresses.enabled" = false; + "extensions.formautofill.creditCards.enabled" = false; + + # remove new tab stuff + "extensions.pocket.enabled" = false; + "services.sync.prefs.sync.browser.newtabpage.activity-stream.feeds.section.topstories" = false; + "browser.newtabpage.activity-stream.section.highlights.includePocket" = false; + "browser.newtabpage.activity-stream.feeds.system.topstories" = false; + "browser.newtabpage.activity-stream.feeds.section.topstories" = false; + "browser.newtabpage.activity-stream.feeds.topsites" = false; + "browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons" = false; + "browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features" = false; + }; + + search = { + default = "DuckDuckGo"; + force = true; + engines = { + "Nix Packages" = { + urls = [{ + template = "https://search.nixos.org/packages"; + params = [ + { name = "type"; value = "packages"; } + { name = "query"; value = "{searchTerms}"; } + ]; + }]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake-white.svg"; + definedAliases = [ "@np" ]; + }; + + "NixOS Wiki" = { + urls = [{ template = + "https://nixos.wiki/index.php?search={searchTerms}"; + }]; + iconUpdateURL = "https://nixos.wiki/favicon.png"; + updateInterval = 24 * 60 * 60 * 1000; # every day + definedAliases = [ "@nw" ]; + }; + + "MyNixos" = { + urls = [{ template = + "https://mynixos.com/search?q={searchTerms}"; + }]; + iconUpdateURL = "https://mynixos.com/favicon.ico"; + updateInterval = 24 * 60 * 60 * 1000; # every day + definedAliases = [ "@mn" ]; + }; + + "Firefox Add-ons" = { + urls = [{ template = + "https://addons.mozilla.org/en-US/firefox/search/?q={searchTerms}"; + }]; + iconUpdateURL = "https://addons.mozilla.org/favicon.ico"; + updateInterval = 24 * 60 * 60 * 1000; # every day + definedAliases = [ "@fa" ]; + }; + + "ProtonDB" = { + urls = [{ template = + "https://www.protondb.com/search?q={searchTerms}"; + }]; + iconUpdateURL = "https://www.protondb.com/favicon.ico"; + updateInterval = 24 * 60 * 60 * 1000; # every day + definedAliases = [ "@pdb" ]; + }; + + "YouTube" = { + urls = [{ template = + "https://www.youtube.com/results?search_query={searchTerms}"; + }]; + iconUpdateURL = "https://www.youtube.com/favicon.ico"; + updateInterval = 24 * 60 * 60 * 1000; # every day + definedAliases = [ "@yt" "@youtube" ]; + }; + + "Bing".metaData.hidden = true; + "Google".metaData.hidden = true; + "eBay".metaData.hidden = true; + }; + order = [ + "DuckDuckGo" + "MyNixos" + "NixOS Wiki" + "Nix Packages" + "Wikipedia (en)" + "YouTube" + "Firefox Add-ons" + "ProtonDB" + "Amazon.ca" + ]; + }; + + extensions = with config.nur.repos; + (with bandithedoge.firefoxAddons; [ + sponsorblock + stylus + #tridactyl + ublock-origin + ]) ++ + + (with rycee.firefox-addons; [ + bitwarden + darkreader + floccus + istilldontcareaboutcookies + image-search-options + return-youtube-dislikes + undoclosetabbutton + ]) ++ + + (with firefox-addons; [ + sound-volume + google-container + checkmarks-web-ext + opera-gx-witchcraft-purple + ]); + }; + }; +} diff --git a/nixos/home/main.nix b/nixos/home/main.nix index 457e162..d3f4a83 100644 --- a/nixos/home/main.nix +++ b/nixos/home/main.nix @@ -27,6 +27,7 @@ ./dotfiles.nix ./packages.nix ./nvim.nix + ./firefox/main.nix ]; home.stateVersion = "23.05";