From 756f21e959e48c53a7685fa1431e68b0c78b7231 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Sun, 7 Dec 2025 12:00:11 +0100 Subject: refactor(workstation): set Firefox preferences via extraPrefs --- nixos/profiles/workstation/graphical.nix | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'nixos/profiles') diff --git a/nixos/profiles/workstation/graphical.nix b/nixos/profiles/workstation/graphical.nix index 8058d26..b09108c 100644 --- a/nixos/profiles/workstation/graphical.nix +++ b/nixos/profiles/workstation/graphical.nix @@ -81,6 +81,27 @@ programs.firefox = { enable = true; + package = + let + prefs = { + # about:config preferences + # We're setting them via extraPrefs because policies.Preferences doesn't support all about:config preferences. + "browser.aboutConfig.showWarning" = false; + "browser.tabs.insertAfterCurrent" = true; + "browser.uidensity" = 1; + "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; # can be changed via UI despite this about:config setting being locked + "layout.css.devPixelsPerPx" = "1.2"; # with this the default Firefox font size matches my terminal font size of 14px + }; + in + (pkgs.wrapFirefox pkgs.firefox-unwrapped { + extraPrefs = with pkgs.lib; '' + ${concatStrings ( + mapAttrsToList (name: value: '' + lockPref("${name}", ${builtins.toJSON value}); + '') prefs + )} + ''; + }); policies = { DontCheckDefaultBrowser = true; @@ -93,14 +114,6 @@ # cannot use SearchEngines because it's only available on ESR :( # (https://mozilla.github.io/policy-templates/#searchengines-this-policy-is-only-available-on-the-esr) - Preferences = { - "layout.css.devPixelsPerPx" = "1.2"; # with this the default Firefox font size matches my terminal font size of 14px - "browser.tabs.insertAfterCurrent" = true; - "browser.uidensity" = 1; - "browser.aboutConfig.showWarning" = false; - "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; # can be changed via UI despite this about:config setting being locked - }; - ExtensionSettings = { "uBlock0@raymondhill.net" = { install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; -- cgit v1.3.1