From 34f74229f8291156f35de943fbecfbe90c3366a9 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Tue, 28 Nov 2023 23:10:04 +0300 Subject: 2023-11-28 --- modules/nixos/firefox/default.nix | 64 ++++++++++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 14 deletions(-) (limited to 'modules/nixos/firefox/default.nix') diff --git a/modules/nixos/firefox/default.nix b/modules/nixos/firefox/default.nix index 041752d..a5d5c89 100644 --- a/modules/nixos/firefox/default.nix +++ b/modules/nixos/firefox/default.nix @@ -73,20 +73,56 @@ in { userContent = mkCssWithRoot ./userContent.css; - extensions = with pkgs.nur.repos.rycee.firefox-addons; - [ - bitwarden - consent-o-matic - darkreader - furiganaize - localcdn - no-pdf-download - noscript - privacy-redirect - ublock-origin - violentmonkey - ] - ++ optional config.nixfiles.modules.ipfs.enable ipfs-companion; + extensions = let + # This was done using the incredible addon generator[1]. All credit + # goes to Robert Helgesson. + # + # [1]: https://sr.ht/~rycee/mozilla-addons-to-nix/ + buildFirefoxXpiAddon = makeOverridable ({ + stdenv ? pkgs.stdenv, + fetchurl ? pkgs.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" + ''; + }); + + addons = import ./addons.nix {inherit buildFirefoxXpiAddon lib;}; + in + with addons; + [ + bitwarden + canvasblocker + consent-o-matic + darkreader + dont-track-me-google + furiganaize + languagetool + localcdn + no-pdf-download + noscript + privacy-redirect + rikaichamp + ublock-origin + user-agent-switcher + violentmonkey + ] + ++ optional config.nixfiles.modules.ipfs.enable ipfs-companion; search = { force = true; -- cgit 1.4.1