From 3c76aa0936c03c5bd16bf489e953140c6e5d086e Mon Sep 17 00:00:00 2001
From: Oliver Davies <oliver@oliverdavies.dev>
Date: Thu, 13 Feb 2025 22:53:24 +0000
Subject: [PATCH] Update Firefox configuration

---
 flake.lock                            | 81 ++++++++++++++++++++++++++-
 flake.nix                             |  2 +
 nix/home/opdavies/desktop/default.nix |  1 +
 nix/home/opdavies/desktop/firefox.nix | 40 +++++++++++++
 nix/hosts/common/default.nix          |  2 +
 nix/hosts/t490/programs.nix           | 11 ----
 6 files changed, 125 insertions(+), 12 deletions(-)
 create mode 100644 nix/home/opdavies/desktop/firefox.nix

diff --git a/flake.lock b/flake.lock
index 80a1b930..588cd561 100644
--- a/flake.lock
+++ b/flake.lock
@@ -79,6 +79,27 @@
         "type": "github"
       }
     },
+    "flake-parts": {
+      "inputs": {
+        "nixpkgs-lib": [
+          "nur",
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1733312601,
+        "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
+        "owner": "hercules-ci",
+        "repo": "flake-parts",
+        "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9",
+        "type": "github"
+      },
+      "original": {
+        "owner": "hercules-ci",
+        "repo": "flake-parts",
+        "type": "github"
+      }
+    },
     "home-manager": {
       "inputs": {
         "nixpkgs": [
@@ -253,6 +274,42 @@
         "type": "github"
       }
     },
+    "nixpkgs_4": {
+      "locked": {
+        "lastModified": 1739214665,
+        "narHash": "sha256-26L8VAu3/1YRxS8MHgBOyOM8xALdo6N0I04PgorE7UM=",
+        "owner": "nixos",
+        "repo": "nixpkgs",
+        "rev": "64e75cd44acf21c7933d61d7721e812eac1b5a0a",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nixos",
+        "ref": "nixos-unstable",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "nur": {
+      "inputs": {
+        "flake-parts": "flake-parts",
+        "nixpkgs": "nixpkgs_4",
+        "treefmt-nix": "treefmt-nix"
+      },
+      "locked": {
+        "lastModified": 1739484678,
+        "narHash": "sha256-UMXcnWnAq/mZ6QULSaPkSsDCa2AcTVyz2lX+d6WBHgk=",
+        "owner": "nix-community",
+        "repo": "NUR",
+        "rev": "dc54e936d513274e1cfa85e8e6aa9f0d7d181299",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-community",
+        "repo": "NUR",
+        "type": "github"
+      }
+    },
     "root": {
       "inputs": {
         "agenix": "agenix",
@@ -263,7 +320,8 @@
         "nixpkgs": "nixpkgs_3",
         "nixpkgs-2405": "nixpkgs-2405",
         "nixpkgs-2411": "nixpkgs-2411",
-        "nixpkgs-master": "nixpkgs-master"
+        "nixpkgs-master": "nixpkgs-master",
+        "nur": "nur"
       }
     },
     "systems": {
@@ -280,6 +338,27 @@
         "repo": "default",
         "type": "github"
       }
+    },
+    "treefmt-nix": {
+      "inputs": {
+        "nixpkgs": [
+          "nur",
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1733222881,
+        "narHash": "sha256-JIPcz1PrpXUCbaccEnrcUS8jjEb/1vJbZz5KkobyFdM=",
+        "owner": "numtide",
+        "repo": "treefmt-nix",
+        "rev": "49717b5af6f80172275d47a418c9719a31a78b53",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "treefmt-nix",
+        "type": "github"
+      }
     }
   },
   "root": "root",
diff --git a/flake.nix b/flake.nix
index 16100c8a..e885b592 100644
--- a/flake.nix
+++ b/flake.nix
@@ -18,6 +18,8 @@
     nixpkgs-master.url = "github:nixos/nixpkgs/master";
 
     nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
+
+    nur.url = "github:nix-community/NUR";
   };
 
   outputs =
diff --git a/nix/home/opdavies/desktop/default.nix b/nix/home/opdavies/desktop/default.nix
index 2b3bd6e6..58d0cf42 100644
--- a/nix/home/opdavies/desktop/default.nix
+++ b/nix/home/opdavies/desktop/default.nix
@@ -2,6 +2,7 @@
 
 {
   imports = [
+    ./firefox.nix
     ./qutebrowser.nix
   ];
 
diff --git a/nix/home/opdavies/desktop/firefox.nix b/nix/home/opdavies/desktop/firefox.nix
new file mode 100644
index 00000000..5f429fc9
--- /dev/null
+++ b/nix/home/opdavies/desktop/firefox.nix
@@ -0,0 +1,40 @@
+{ pkgs, ... }:
+
+{
+  programs.firefox = {
+    enable = true;
+
+    languagePacks = [ "en-GB" ];
+
+    profiles = {
+      default = {
+        extensions = with pkgs.nur.repos.rycee.firefox-addons; [
+          bitwarden
+          darkreader
+          onetab
+          tree-style-tab
+          ublock-origin
+          vimium
+          web-developer
+        ];
+
+        preConfig = builtins.readFile "${pkgs.arkenfox-userjs}/user.js";
+
+        search = {
+          default = "DuckDuckGo";
+          force = true;
+          privateDefault = "DuckDuckGo";
+        };
+
+        settings = {
+          "browser.search.isUS" = false;
+          "browser.search.region" = "GB";
+          "distribution.searchplugins.defaultLocale" = "en-GB";
+          "general.useragent.locale" = "en-GB";
+          "intl.accept_languages" = "en-GB, en";
+          "intl.regional_prefs.use_os_locales" = true;
+        };
+      };
+    };
+  };
+}
diff --git a/nix/hosts/common/default.nix b/nix/hosts/common/default.nix
index 929063e4..c7c2c77f 100644
--- a/nix/hosts/common/default.nix
+++ b/nix/hosts/common/default.nix
@@ -71,6 +71,8 @@
     };
 
     overlays = [
+      inputs.nur.overlays.default
+
       outputs.overlays.additions
       outputs.overlays.modifications
       outputs.overlays.stable-packages
diff --git a/nix/hosts/t490/programs.nix b/nix/hosts/t490/programs.nix
index df1b6e8e..aa7e2c3f 100644
--- a/nix/hosts/t490/programs.nix
+++ b/nix/hosts/t490/programs.nix
@@ -9,16 +9,5 @@
       enableSSHSupport = true;
       pinentryPackage = pkgs.pinentry-qt;
     };
-
-    firefox = {
-      enable = true;
-
-      languagePacks = [ "en-GB" ];
-
-      preferences = {
-        "intl.accept_languages" = "en-GB, en";
-        "intl.regional_prefs.use_os_locales" = true;
-      };
-    };
   };
 }