Subject: [bug#66408] [PATCH v3] gnu: icecat: Add support for Guix packaged extensions.

From: Clément Lassieur <[email-masked]>
Date: Wed, 11 Oct 2023 16:52:29 +0200

Hello,

Now that this patch looks stable to me, please let me introduce it
shortly.  I believe that a lot of people use Icecat extensions
downloaded from Mozilla store[2].  Mozzarella[1] is really just a
"plugin finder", so the extension is really downloaded from
https://addons.mozilla.org/, which means we have no control over the
software we are running, except for the bundled extensions.  An upgrade
could very well import non-free software when the initial version was
free.

I think it would be great to do like we do with Emacs and a lot of other
softwares: package our own plugins.  That would give users the assurance
that the software is free and can be trusted as they trust any Guix
packaged software.  That would also allow to do Guix-specific changes,
like removing the non-free bits, or adapting the package for technical
reasons.  And that would allow for a declarative deployment of the
browser, because the extensions could be added, say, to the Guix home
config.scm.

So this is what this patch is about.  And it works with the only add-on
that is currently packaged: uBlock Origin.  To test it one needs to
install both "icecat" and "ublock-origin-icecat".  This is related to
the work Marius did on ungoogled-chromium, and of course to the work
Mark did on Icecat, so both of you are CCed.  As for the technical
details, there is a long comment in "icecat-extensions.scm" explaining
what I did.

Thank you,
Clément Lassieur

[1]: https://gnuzilla.gnu.org/mozzarella/
[2]: https://addons.mozilla.org/

> * gnu/build/icecat-extension.scm: New file with a MAKE-ICECAT-EXTENSION
> procedure that makes sure the add-on directory is a symlink, so that Icecat
> can normalize it into a package store path.
> * gnu/local.mk (dist_patch_DATA): Register it, as well as new patches.
> * gnu/packages/browser-extensions.scm (ublock-origin)[properties]: Store the
> add-on ID so that it is accessible in MAKE-ICECAT-EXTENSION.
> [arguments]: Use the add-on ID as root directory.
> (ublock-origin/icecat): New procedure.
> * gnu/packages/gnuzilla.scm (icecat-minimal)[arguments]: Rewrite the unused
> 'apply-guix-specific-patches' phase so that it applies the following two
> patches.
> [native-search-paths]: New field.
> * gnu/packages/patches/icecat-compare-paths.patch: New patch that compares
> add-on paths (which are package store paths) to detect package changes.
> * gnu/packages/patches/icecat-use-guix-extensions.patch: New patch that
> replaces "/usr/share/mozilla/extensions" with "$ICECAT_EXTENSION_DIR".