diff options
| author | quentin@aristote.fr <quentin@aristote.fr> | 2026-10-12 23:31:36 +0200 |
|---|---|---|
| committer | quentin@aristote.fr <quentin@aristote.fr> | 2026-10-13 00:10:12 +0200 |
| commit | 92ecf9711ff726b9be11bab9c9baa1bfbea90bf6 (patch) | |
| tree | 89e14210af47750eb652836deec21d75e461d8be /modules/home-manager/personal | |
| parent | 9db2fdc210978b0b8a519b8b5e035a1b1febe89a (diff) | |
| download | my-nixpkgs-92ecf9711ff726b9be11bab9c9baa1bfbea90bf6.tar.gz my-nixpkgs-92ecf9711ff726b9be11bab9c9baa1bfbea90bf6.tar.bz2 my-nixpkgs-92ecf9711ff726b9be11bab9c9baa1bfbea90bf6.tar.xz | |
home: firefox: reorganize
Diffstat (limited to 'modules/home-manager/personal')
| -rw-r--r-- | modules/home-manager/personal/programs/firefox/default.nix | 103 | ||||
| -rw-r--r-- | modules/home-manager/personal/programs/firefox/extensions.nix | 88 | ||||
| -rw-r--r-- | modules/home-manager/personal/programs/firefox/search.nix (renamed from modules/home-manager/personal/programs/firefox/engines.nix) | 38 | ||||
| -rw-r--r-- | modules/home-manager/personal/programs/firefox/userjs.nix | 134 |
4 files changed, 193 insertions, 170 deletions
diff --git a/modules/home-manager/personal/programs/firefox/default.nix b/modules/home-manager/personal/programs/firefox/default.nix index 0966be1..8f33e38 100644 --- a/modules/home-manager/personal/programs/firefox/default.nix +++ b/modules/home-manager/personal/programs/firefox/default.nix @@ -1,112 +1,27 @@ { config, lib, - pkgs, ... }: -with lib; -let - userjs = pkgs.callPackage ./userjs.nix { - inherit (pkgs.personal.static.userjs) arkenfox; - inherit (pkgs.lib.personal) toUserJS; - }; - engines = import ./engines.nix { inherit lib pkgs; }; - extensions = { - canvasblocker = { - id = "CanvasBlocker@kkapsner.de"; - }; - url-in-title-keepass = { - id = "{fcdb71fb-c9e5-48a3-9d04-e32713f5da88}"; - }; - clearurls = { - id = "{74145f27-f039-47ce-a470-a662b129930a}"; - }; - temporary-containers = { - id = "{c607c8df-14a7-4f28-894f-29e8722976af}"; - }; - floccus = { - id = "floccus@handmadeideas.org"; - }; - darkreader = { - id = "addon@darkreader.org"; - }; - ublock-origin = { - id = "uBlock0@raymondhill.net"; - }; - firefox-color = { - id = "FirefoxColor@mozilla.com"; - }; - }; - -in { + imports = [ + ./extensions.nix + ./search.nix + ./userjs.nix + ]; + config = lib.mkMerge [ { stylix.targets.firefox = { - colorTheme.enable = true; + colorTheme.enable = true; # overriden settings in ./extensions.nix profileNames = [ "default" ]; }; + programs.firefox = { configPath = "${config.xdg.configHome}/mozilla/firefox"; - policies.ExtensionSettings = { - "*".installation_mode = "blocked"; - } - // lib.mapAttrs' (name: value: { - name = value.id; - value = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/${name}/latest.xpi"; - installation_mode = "force_installed"; - updates_disabled = true; - }; - }) extensions; - profiles.default = { - id = 0; # isDefault = true - extensions = { - settings."FirefoxColor@mozilla.com" = { - force = true; - settings.theme.colors = - let - mkBgColor = lib.mkForce ( - with config.lib.stylix.colors; - { - r = base00-rgb-r; - g = base00-rgb-g; - b = base00-rgb-b; - } - ); - in - { - frame = mkBgColor; - sidebar_border = mkBgColor; - popup_border = mkBgColor; - tab_baground_separator = mkBgColor; - tab_line = mkBgColor; - toolbar_field_border_focus = mkBgColor; - }; - }; - }; - search = { - force = lib.mkDefault true; - engines = - with engines; - disableDefault - // { - inherit Searx; - } - // lib.optionalAttrs config.personal.identities.personal personal - // lib.optionalAttrs config.personal.identities.work work - // lib.optionalAttrs config.personal.profiles.dev dev; - default = "Searx"; - order = [ - "Searx" - "Wikipedia" - ]; - }; - extraConfig = userjs.default; - }; - + profiles.default.id = 0; # isDefault = true }; } diff --git a/modules/home-manager/personal/programs/firefox/extensions.nix b/modules/home-manager/personal/programs/firefox/extensions.nix new file mode 100644 index 0000000..60982b9 --- /dev/null +++ b/modules/home-manager/personal/programs/firefox/extensions.nix @@ -0,0 +1,88 @@ +{ + config, + lib, + ... +}: +let + extensions = { + canvasblocker = { + id = "CanvasBlocker@kkapsner.de"; + }; + url-in-title-keepass = { + id = "{fcdb71fb-c9e5-48a3-9d04-e32713f5da88}"; + }; + clearurls = { + id = "{74145f27-f039-47ce-a470-a662b129930a}"; + }; + temporary-containers = { + id = "{c607c8df-14a7-4f28-894f-29e8722976af}"; + }; + floccus = { + id = "floccus@handmadeideas.org"; + }; + darkreader = { + id = "addon@darkreader.org"; + }; + ublock-origin = { + id = "uBlock0@raymondhill.net"; + }; + firefox-color = { + id = "FirefoxColor@mozilla.com"; + settings.theme.colors = + let + mkBgColor = lib.mkForce ( + with config.lib.stylix.colors; + { + r = base00-rgb-r; + g = base00-rgb-g; + b = base00-rgb-b; + } + ); + in + { + frame = mkBgColor; + sidebar_border = mkBgColor; + popup_border = mkBgColor; + tab_baground_separator = mkBgColor; + tab_line = mkBgColor; + toolbar_field_border_focus = mkBgColor; + }; + }; + }; +in +{ + programs.firefox = { + policies.ExtensionSettings = { + "*".installation_mode = "blocked"; + } + // lib.mapAttrs' (name: { id, ... }: { + name = id; + value = { + install_url = "https://addons.mozilla.org/firefox/downloads/latest/${name}/latest.xpi"; + installation_mode = "force_installed"; + updates_disabled = true; + }; + }) extensions; + + profiles.default.extensions.settings = lib.mapAttrs' ( + _: + { + id, + settings ? { }, + }: + { + name = id; + value = + if settings != { } then + { + force = true; + inherit settings; + } + else + { + force = false; + }; + } + ) extensions; + }; +} diff --git a/modules/home-manager/personal/programs/firefox/engines.nix b/modules/home-manager/personal/programs/firefox/search.nix index 87f74e5..0a4178d 100644 --- a/modules/home-manager/personal/programs/firefox/engines.nix +++ b/modules/home-manager/personal/programs/firefox/search.nix @@ -1,37 +1,39 @@ { + config, lib, pkgs, + ... }: let everyday = 24 * 60 * 60 * 1000; searchTerms = "{searchTerms}"; nixosIcon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; - self = { + engines = { disable = engines: lib.genAttrs engines (_: { metaData.hidden = true; }); - disableDefault = self.disable [ + disableDefault = engines.disable [ "google" "Amazon.fr" "bing" ]; nix = { - inherit (self) + inherit (engines) "Home Manager Options" "NixOS Options" "NixOS Wiki" "Nix Packages" ; }; - dev = self.nix // { - inherit (self) AlternativeTo Phind; + dev = engines.nix // { + inherit (engines) AlternativeTo Phind; }; - personal = { inherit (self) Emojipedia; }; - work = { inherit (self) nLab; }; - all = self.dev // self.personal // self.work // { inherit (self) Searx; }; + personal = { inherit (engines) Emojipedia; }; + work = { inherit (engines) nLab; }; + all = engines.dev // engines.personal // engines.work // { inherit (engines) Searx; }; Emojipedia = { urls = [ @@ -172,4 +174,22 @@ let }; }; in -self +{ + programs.firefox.profiles.default.search = { + force = lib.mkDefault true; + engines = + with engines; + disableDefault + // { + inherit Searx; + } + // lib.optionalAttrs config.personal.identities.personal personal + // lib.optionalAttrs config.personal.identities.work work + // lib.optionalAttrs config.personal.profiles.dev dev; + default = "Searx"; + order = [ + "Searx" + "Wikipedia" + ]; + }; +} diff --git a/modules/home-manager/personal/programs/firefox/userjs.nix b/modules/home-manager/personal/programs/firefox/userjs.nix index 4fda63f..5db8e58 100644 --- a/modules/home-manager/personal/programs/firefox/userjs.nix +++ b/modules/home-manager/personal/programs/firefox/userjs.nix @@ -1,74 +1,74 @@ { - arkenfox, - toUserJS, + pkgs, + ... }: let - self = { - arkenfox = builtins.readFile "${arkenfox}"; - default = - self.arkenfox - + toUserJS { - "signon.rememberSignons" = false; # 0901 - "security.nocertdb" = true; # 1222 - "media.peerconnection.enabled" = false; # 2001 - "media.peerconnection.ice.no_host" = true; # 2004 - "dom.allow_cut_copy" = true; # 2404 - "dom.battery.enabled" = false; # 2502 - "permissions.default.xr" = 2; # 2521 - "browser.search.separatePrivateDefault" = false; # 0830 - "browser.search.separatePrivateDefault.ui.enabled" = false; # 0830 - "privacy.clearOnShutdown_v2.historyFormDataAndDownloads" = true; # 2811 - "privacy.clearOnShutdown_v2.browsingHistoryAndDownloads" = true; # 2812 - "privacy.clearOnShutdown_v2.downloads" = true; # 2812 - "privacy.clearSiteData.historyFormDataAndDownloads" = true; # 2820 - "privacy.clearSiteData.browsingHistoryAndDownloads" = true; # 2821 - "privacy.clearHistory.historyFormDataAndDownloads" = true; # 2830 - "privacy.clearHistory.browsingHistoryAndDownloads" = true; # 2831 + arkenfox = builtins.readFile "${pkgs.personal.static.userjs.arkenfox}"; + default = + arkenfox + + pkgs.lib.personal.toUserJS { + "signon.rememberSignons" = false; # 0901 + "security.nocertdb" = true; # 1222 + "media.peerconnection.enabled" = false; # 2001 + "media.peerconnection.ice.no_host" = true; # 2004 + "dom.allow_cut_copy" = true; # 2404 + "dom.battery.enabled" = false; # 2502 + "permissions.default.xr" = 2; # 2521 + "browser.search.separatePrivateDefault" = false; # 0830 + "browser.search.separatePrivateDefault.ui.enabled" = false; # 0830 + "privacy.clearOnShutdown_v2.historyFormDataAndDownloads" = true; # 2811 + "privacy.clearOnShutdown_v2.browsingHistoryAndDownloads" = true; # 2812 + "privacy.clearOnShutdown_v2.downloads" = true; # 2812 + "privacy.clearSiteData.historyFormDataAndDownloads" = true; # 2820 + "privacy.clearSiteData.browsingHistoryAndDownloads" = true; # 2821 + "privacy.clearHistory.historyFormDataAndDownloads" = true; # 2830 + "privacy.clearHistory.browsingHistoryAndDownloads" = true; # 2831 - # Personal - ## Warnings - "browser.tabs.warnOnClose" = false; - "browser.tabs.warnOnCloseOtherTabs" = false; - ## Updates - "app.update.auto" = false; - "browser.search.update" = false; - ## Appearance - "toolkit.legacyUserProfileCustomizations.stylesheets" = true; - ## Content behavior - "clipboard.autocopy" = false; - ## UX behavior - "browser.quitShortcut.disabled" = true; - "browser.tabs.closeWindowWithLastTab" = false; - ## UX features - "extensions.pocket.enabled" = false; - "identity.fxaccounts.enabled" = false; - }; + # Personal + ## Warnings + "browser.tabs.warnOnClose" = false; + "browser.tabs.warnOnCloseOtherTabs" = false; + ## Updates + "app.update.auto" = false; + "browser.search.update" = false; + ## Appearance + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + ## Content behavior + "clipboard.autocopy" = false; + ## UX behavior + "browser.quitShortcut.disabled" = true; + "browser.tabs.closeWindowWithLastTab" = false; + ## UX features + "extensions.pocket.enabled" = false; + "identity.fxaccounts.enabled" = false; + }; - streaming = - self.default - + toUserJS { - # Cache - "browser.cache.disk.enable" = true; - "browser.cache.offline.storage" = true; - # Privacy - "privacy.clearOnShutdown_v2.cache" = false; - "privacy.clearOnShutdown_v2.cookiesAndStorage" = false; - }; + # streaming = + # default + # + pkgs.lib.personal.toUserJS { + # # Cache + # "browser.cache.disk.enable" = true; + # "browser.cache.offline.storage" = true; + # # Privacy + # "privacy.clearOnShutdown_v2.cache" = false; + # "privacy.clearOnShutdown_v2.cookiesAndStorage" = false; + # }; - videoconferencing = - self.default - + toUserJS { - # IMPORTANT: uncheck "Prevent WebRTC from leaking local IP addresses" in uBlock Origin's settings - # NOTE: if using RFP (4501) - # some sites, e.g. Zoom, need a canvas site exception [Right Click>View Page Info>Permissions] - # Discord video does not work: it thinks you are FF78: use a separate profile or spoof the user agent - "media.peerconnection.enabled" = true; - "media.peerconnection.ice.no_host" = false; # may or may not be required - "webgl.min_capability_mode" = true; - "media.autoplay.blocking_policy" = 0; # optional (otherwise add site exceptions) - "javascript.options.wasm" = true; # optional (some platforms may require this) - "dom.webaudio.enabled" = true; - }; - }; + # videoconferencing = + # default + # + pkgs.lib.personal.toUserJS { + # # IMPORTANT: uncheck "Prevent WebRTC from leaking local IP addresses" in uBlock Origin's settings + # # NOTE: if using RFP (4501) + # # some sites, e.g. Zoom, need a canvas site exception [Right Click>View Page Info>Permissions] + # # Discord video does not work: it thinks you are FF78: use a separate profile or spoof the user agent + # "media.peerconnection.enabled" = true; + # "media.peerconnection.ice.no_host" = false; # may or may not be required + # "webgl.min_capability_mode" = true; + # "media.autoplay.blocking_policy" = 0; # optional (otherwise add site exceptions) + # "javascript.options.wasm" = true; # optional (some platforms may require this) + # "dom.webaudio.enabled" = true; + # }; in -self +{ + programs.firefox.profiles.default.extraConfig = default; +} |
