diff --git a/flake.lock b/flake.lock index c6e9d892..c8c4886f 100644 --- a/flake.lock +++ b/flake.lock @@ -26,6 +26,26 @@ "type": "github" } }, + "betterfox-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1731153579, + "narHash": "sha256-9mNttz8Az2gOUHD2mOKiY1Fv2FHNxcQpu+FwfA1l1aM=", + "owner": "HeitorAugustoLN", + "repo": "betterfox-nix", + "rev": "4746610b0ab006aefa732e727048e330d19e4f81", + "type": "github" + }, + "original": { + "owner": "HeitorAugustoLN", + "repo": "betterfox-nix", + "type": "github" + } + }, "cities-json": { "flake": false, "locked": { @@ -964,6 +984,7 @@ "root": { "inputs": { "agenix": "agenix", + "betterfox-nix": "betterfox-nix", "cities-json": "cities-json", "colmena": "colmena", "composer2nix": "composer2nix", diff --git a/flake.nix b/flake.nix index 0be31aa4..2d64efbf 100644 --- a/flake.nix +++ b/flake.nix @@ -19,6 +19,10 @@ inputs.home-manager.follows = "home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; + betterfox-nix = { + url = "github:HeitorAugustoLN/betterfox-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; cities-json = { url = "github:lutangar/cities.json"; flake = false; diff --git a/nixos/client-apps/firefox.nix b/nixos/client-apps/firefox.nix index 38007ca4..9bf6c18c 100644 --- a/nixos/client-apps/firefox.nix +++ b/nixos/client-apps/firefox.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, ... }: +{ + pkgs, + lib, + inputs, + ... +}: let extensions = with pkgs.nur.repos.rycee.firefox-addons; [ bitwarden @@ -32,6 +37,40 @@ let wappalyzer wayback-machine ]; + + loadBetterfox = + path: + let + autogen = lib.importJSON (inputs.betterfox-nix + "/autogen/firefox/main.json"); + settings = lib.attrByPath (lib.splitString "." "${path}.settings") null autogen; + in + builtins.listToAttrs (builtins.filter (v: v.enabled) settings); + + betterfoxConfig = builtins.foldl' (a: b: a // loadBetterfox b) { } [ + "fastfox.general" + "fastfox.gfx" + "fastfox.disk-cache" + "fastfox.media-cache" + "fastfox.image-cache" + "fastfox.network" + "fastfox.speculative-loading" + "fastfox.experimental" + "securefox.ocsp-and-certs-with-hpkp" + "securefox.ssl-with-tls" + "securefox.disk-avoidance" + "securefox.https-first-policy" + "securefox.mixed-content-plus-cross-site" + "securefox.headers-with-referers" + "securefox.safe-browsing" + "securefox.telemetry" + "securefox.experiments" + "securefox.crash-reports" + "peskyfox.mozilla-ui" + "peskyfox.url-bar" + "peskyfox.new-tab-page" + "peskyfox.pocket" + "peskyfox.downloads" + ]; in { environment.systemPackages = [ @@ -140,7 +179,7 @@ in ) extensions ); }; - preferences = { + preferences = betterfoxConfig // { "browser.aboutConfig.showWarning" = false; "gfx.webrender.all" = true; "gfx.webrender.compositor.force-enabled" = true;