diff options
| author | Martin Fischer <martin@push-f.com> | 2025-12-11 06:37:05 +0100 |
|---|---|---|
| committer | Martin Fischer <martin@push-f.com> | 2025-12-11 06:37:05 +0100 |
| commit | 00c985302ed41c6037e9cf34c91e4547d7f8247e (patch) | |
| tree | 7eaa934f2b0cbc035edc1aaa1fed76e79fc0478a | |
| parent | 4c384b01695c490e816cbe4e22ce186f000991ba (diff) | |
refactor: move firefox config to own module
| -rw-r--r-- | nixos/profiles/workstation/default.nix | 1 | ||||
| -rw-r--r-- | nixos/profiles/workstation/firefox.nix | 59 | ||||
| -rw-r--r-- | nixos/profiles/workstation/graphical.nix | 55 |
3 files changed, 60 insertions, 55 deletions
diff --git a/nixos/profiles/workstation/default.nix b/nixos/profiles/workstation/default.nix index 2fb983a..4247d12 100644 --- a/nixos/profiles/workstation/default.nix +++ b/nixos/profiles/workstation/default.nix @@ -15,6 +15,7 @@ in ../common <top/shared/basics-physical.nix> ./graphical.nix + ./firefox.nix ./dev.nix ./create.nix ./android.nix diff --git a/nixos/profiles/workstation/firefox.nix b/nixos/profiles/workstation/firefox.nix new file mode 100644 index 0000000..faed6a3 --- /dev/null +++ b/nixos/profiles/workstation/firefox.nix @@ -0,0 +1,59 @@ +{ config, pkgs, ... }: + +{ + 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.ml.chat.menu" = false; + "browser.tabs.insertAfterCurrent" = true; + "browser.translations.automaticallyPopup" = false; + "browser.uidensity" = 1; + "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; # can be changed via UI despite this about:config setting being locked + "identity.fxaccounts.enabled" = false; + "layout.css.devPixelsPerPx" = "1.2"; # with this the default Firefox font size matches my terminal font size of 14px + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + }; + in + (pkgs.wrapFirefox pkgs.firefox-unwrapped { + extraPrefs = with pkgs.lib; '' + ${concatStrings ( + mapAttrsToList (name: value: '' + lockPref("${name}", ${builtins.toJSON value}); + '') prefs + )} + ''; + }); + + policies = { + DontCheckDefaultBrowser = true; + DisablePocket = true; + FirefoxHome = { + SponsoredTopSites = false; + }; + + SearchSuggestEnabled = false; + # 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) + + ExtensionSettings = { + "uBlock0@raymondhill.net" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; + installation_mode = "force_installed"; + }; + }; + + PasswordManagerEnabled = false; + AutofillCreditCardEnabled = false; + ExtensionSettings."{446900e4-71c2-419f-a6a7-df9c091e268b}" = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/bitwarden-password-manager/latest.xpi"; + installation_mode = "force_installed"; + }; + }; + }; + +} diff --git a/nixos/profiles/workstation/graphical.nix b/nixos/profiles/workstation/graphical.nix index 10ca662..c30a24e 100644 --- a/nixos/profiles/workstation/graphical.nix +++ b/nixos/profiles/workstation/graphical.nix @@ -79,61 +79,6 @@ enable = true; }; - 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.ml.chat.menu" = false; - "browser.tabs.insertAfterCurrent" = true; - "browser.translations.automaticallyPopup" = false; - "browser.uidensity" = 1; - "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; # can be changed via UI despite this about:config setting being locked - "identity.fxaccounts.enabled" = false; - "layout.css.devPixelsPerPx" = "1.2"; # with this the default Firefox font size matches my terminal font size of 14px - "toolkit.legacyUserProfileCustomizations.stylesheets" = true; - }; - in - (pkgs.wrapFirefox pkgs.firefox-unwrapped { - extraPrefs = with pkgs.lib; '' - ${concatStrings ( - mapAttrsToList (name: value: '' - lockPref("${name}", ${builtins.toJSON value}); - '') prefs - )} - ''; - }); - - policies = { - DontCheckDefaultBrowser = true; - DisablePocket = true; - FirefoxHome = { - SponsoredTopSites = false; - }; - - SearchSuggestEnabled = false; - # 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) - - ExtensionSettings = { - "uBlock0@raymondhill.net" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; - installation_mode = "force_installed"; - }; - }; - - PasswordManagerEnabled = false; - AutofillCreditCardEnabled = false; - ExtensionSettings."{446900e4-71c2-419f-a6a7-df9c091e268b}" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/bitwarden-password-manager/latest.xpi"; - installation_mode = "force_installed"; - }; - }; - }; - systemd.user.services.hugo-notes = { after = ["network.target"]; |
