about summary refs log tree commit diff
path: root/modules/nixos/firefox/default.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/nixos/firefox/default.nix64
1 files changed, 50 insertions, 14 deletions
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;

Consider giving Nix/NixOS a try! <3