From 8f9eff1640c5eb402f93567314e01ca223165259 Mon Sep 17 00:00:00 2001 From: Daniel Fainberg Date: Fri, 10 Jul 2026 12:19:40 +0200 Subject: [PATCH] feat(librewolf): expose package as an overridable option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move librewolf out of the bare package list into its own module declaring `local.librewolf.package` (default pkgs.librewolf), mirroring texlive. Lets a consumer swap the wrapped package — extraPolicies/extraPrefs — to share extensions and an about:config baseline across profiles without editing the module. Co-Authored-By: Claude Opus 4.8 --- modules/home.nix | 5 +++-- modules/librewolf.nix | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 modules/librewolf.nix diff --git a/modules/home.nix b/modules/home.nix index e85a505..efae56c 100644 --- a/modules/home.nix +++ b/modules/home.nix @@ -71,7 +71,7 @@ let ''; in { - imports = [ ./gpg.nix ./media.nix ./texlive.nix ]; + imports = [ ./gpg.nix ./media.nix ./texlive.nix ./librewolf.nix ]; # Put ~/.local/bin (the XDG user-bin dir) on PATH so hand-dropped scripts run # by name without wiring each through nix. @@ -119,7 +119,8 @@ in xdg.enable = true; home.packages = with pkgs; [ - librewolf + # librewolf is installed by ./librewolf.nix (via local.librewolf.package) so + # the wrapped package stays overridable — do NOT also list it here. keepassxc # config in ~/.config/keepassxc papirus-icon-theme # fuzzel icon-theme; ships non-symbolic power icons # (Adwaita only has them as symbolic, which fuzzel skips) diff --git a/modules/librewolf.nix b/modules/librewolf.nix new file mode 100644 index 0000000..ad5bc83 --- /dev/null +++ b/modules/librewolf.nix @@ -0,0 +1,35 @@ +# LibreWolf browser. The package is an option so a consumer can swap the wrapped +# package without editing this module: the base is plain pkgs.librewolf, but the +# wrapper (wrapFirefox) accepts `extraPolicies` and `extraPrefs`, and overriding +# those is the clean way to manage LibreWolf declaratively. +# +# The useful case is sharing state across LibreWolf profiles that otherwise stay +# separate (each `-P ` has its own history/logins/cookies). Enterprise +# policy `ExtensionSettings` force- or normal-installs the same add-ons into +# every profile, and `extraPrefs` (autoconfig `defaultPref`/`lockPref`) seeds a +# shared about:config baseline — both applied per-launch, neither touching +# per-profile user data. Override, e.g.: +# +# local.librewolf.package = pkgs.librewolf.override { +# extraPolicies.ExtensionSettings."uBlock0@raymondhill.net" = { +# installation_mode = "normal_installed"; +# install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; +# }; +# extraPrefs = ''defaultPref("browser.startup.page", 3);''; +# }; +{ config, lib, pkgs, ... }: + +{ + options.local.librewolf.package = lib.mkOption { + type = lib.types.package; + default = pkgs.librewolf; + defaultText = lib.literalExpression "pkgs.librewolf"; + description = '' + LibreWolf package. Override with + `pkgs.librewolf.override { extraPolicies = …; extraPrefs = …; }` + to share extensions/settings across profiles. + ''; + }; + + config.home.packages = [ config.local.librewolf.package ]; +}