From 6c0003aa0b0823db7e8ea3db27c39b0851b0161f Mon Sep 17 00:00:00 2001 From: Anthony Rodriguez Date: Mon, 21 Oct 2024 19:08:21 +0200 Subject: [PATCH] home/programs/browsers: declare firefox addons and start configuring them --- flake.lock | 69 ++++++++++++++++++++---------- flake.nix | 7 ++- home/programs/browsers/firefox.nix | 57 +++++++++++++++++++++++- hosts/solaire/default.nix | 1 + 4 files changed, 108 insertions(+), 26 deletions(-) diff --git a/flake.lock b/flake.lock index 9faba70..54a77a7 100644 --- a/flake.lock +++ b/flake.lock @@ -82,6 +82,29 @@ "type": "github" } }, + "firefox-addons": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "dir": "pkgs/firefox-addons", + "lastModified": 1729491205, + "narHash": "sha256-luvUK8ZTRTdsVao7VqnxvGEvA3rjEmfiwakDyHxQhx8=", + "owner": "rycee", + "repo": "nur-expressions", + "rev": "9764579885c84ba5d4bcd9d3061409a527ff805c", + "type": "gitlab" + }, + "original": { + "dir": "pkgs/firefox-addons", + "owner": "rycee", + "repo": "nur-expressions", + "type": "gitlab" + } + }, "flake-compat": { "flake": false, "locked": { @@ -224,6 +247,21 @@ } }, "flake-utils": { + "locked": { + "lastModified": 1629284811, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c5d161cc0af116a2e17f54316f0bf43f0819785c", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { "inputs": { "systems": [ "systems" @@ -243,7 +281,7 @@ "type": "github" } }, - "flake-utils_2": { + "flake-utils_3": { "inputs": { "systems": "systems_2" }, @@ -261,7 +299,7 @@ "type": "github" } }, - "flake-utils_3": { + "flake-utils_4": { "inputs": { "systems": "systems_3" }, @@ -279,7 +317,7 @@ "type": "github" } }, - "flake-utils_4": { + "flake-utils_5": { "inputs": { "systems": "systems_6" }, @@ -421,7 +459,7 @@ "crane": "crane", "flake-compat": "flake-compat_2", "flake-parts": "flake-parts_3", - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils_3", "nixpkgs": [ "nixpkgs" ], @@ -830,25 +868,10 @@ "type": "sourcehut" } }, - "nur": { - "locked": { - "lastModified": 1729516261, - "narHash": "sha256-uvW3pAtku4QrCjkThTFwJjLmS5evHPSH6XBGZFHGquA=", - "owner": "nix-community", - "repo": "NUR", - "rev": "282dfd5c7da86c7315c231b95e95d71b36f22347", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "NUR", - "type": "github" - } - }, "nvf": { "inputs": { "flake-parts": "flake-parts_5", - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils_4", "mnw": "mnw", "nil": "nil", "nixpkgs": "nixpkgs_6", @@ -2663,14 +2686,14 @@ "ags": "ags", "basix": "basix", "chaotic": "chaotic", + "firefox-addons": "firefox-addons", "flake-parts": "flake-parts_2", - "flake-utils": "flake-utils", + "flake-utils": "flake-utils_2", "home-manager": "home-manager_2", "lanzaboote": "lanzaboote", "niri": "niri", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs_5", - "nur": "nur", "nvf": "nvf", "plasma-manager": "plasma-manager", "systems": "systems_5", @@ -2876,7 +2899,7 @@ }, "wezterm": { "inputs": { - "flake-utils": "flake-utils_4", + "flake-utils": "flake-utils_5", "freetype2": "freetype2", "harfbuzz": "harfbuzz", "libpng": "libpng", diff --git a/flake.nix b/flake.nix index 7e405bf..c3722fb 100644 --- a/flake.nix +++ b/flake.nix @@ -38,6 +38,11 @@ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; chaotic.url = "github:chaotic-cx/nyx/nyxpkgs-unstable"; + firefox-addons = { + url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; @@ -75,8 +80,6 @@ treefmt-nix.url = "github:numtide/treefmt-nix"; - nur.url = "github:nix-community/NUR"; - nixos-hardware.url = "github:NixOS/nixos-hardware"; }; } diff --git a/home/programs/browsers/firefox.nix b/home/programs/browsers/firefox.nix index a34e2bb..769a3ab 100644 --- a/home/programs/browsers/firefox.nix +++ b/home/programs/browsers/firefox.nix @@ -1,6 +1,6 @@ { + lib, inputs, - config, pkgs, ... }: let @@ -13,6 +13,51 @@ in { programs.firefox = { enable = true; + policies = { + DisableTelemetry = true; + DisablePocket = true; + DisableFeedbackCommands = true; + DisableFirefoxStudies = true; + OfferToSaveLogins = false; + OffertosaveloginsDefault = false; + PasswordManagerEnabled = false; + + # https://github.com/Sly-Harvey/NixOS/blob/f9da2691ea46565256ad757959cfc26ec6cee10d/modules/programs/browser/firefox/default.nix#L58-L163 + # TODO: declare which block lists are needed + "3rdparty".Extensions = { + "addon@darkreader.org" = { + permissions = ["internal:privateBrowsingAllowed"]; + enabled = true; + automation = { + enabled = true; + behavior = "OnOff"; + mode = "system"; + }; + detectDarkTheme = true; + enabledByDefault = true; + changeBrowserTheme = false; + enableForProtectedPages = true; + fetchNews = false; + previewNewDesign = true; + }; + "uBlock0@raymondhill.net" = { + permissions = ["internal:privateBrowsingAllowed"]; + advancedSettings = [ + [ + "userResourcesLocation" + "https://raw.githubusercontent.com/pixeltris/TwitchAdSolutions/master/video-swap-new/video-swap-new-ublock-origin.js" + ] + ]; + adminSettings = { + userSettings = { + uiTheme = "dark"; + advancedUserEnabled = true; + userFiltersTrusted = true; + }; + }; + }; + }; + }; profiles = { nezia = { settings = { @@ -21,6 +66,16 @@ in { "ui.key.menuAccessKeyFocuses" = false; }; + extensions = with inputs.firefox-addons.packages.${pkgs.system}; [ + darkreader + proton-pass + shinigami-eyes + stylus + ublock-origin + violentmonkey + idontcareaboutcookies + ]; + # https://git.jacekpoz.pl/poz/niksos/src/commit/a48647a1c5bc6877a1100a65f4dc169b2fc11ed7/hosts/hape/firefox.nix search = { default = "SearxNG"; diff --git a/hosts/solaire/default.nix b/hosts/solaire/default.nix index fe5c33d..ee48080 100644 --- a/hosts/solaire/default.nix +++ b/hosts/solaire/default.nix @@ -19,6 +19,7 @@ in { home-manager = { users.nezia.imports = [ "${self}/home" + "${self}/home/programs/games" "${self}/home/terminal/emulators/foot.nix" ];